func getGclCln()

in pkg/client/keycloak/adapter/gocloak_adapter.go [502:554]


func getGclCln(client *dto.Client) gocloak.Client {
	//TODO: check collision with protocol mappers list in spec
	protocolMappers := getProtocolMappers(client.AdvancedProtocolMappers)

	cl := gocloak.Client{
		Attributes:                   &client.Attributes,
		AuthorizationServicesEnabled: &client.AuthorizationServicesEnabled,
		BearerOnly:                   &client.BearerOnly,
		ClientAuthenticatorType:      &client.ClientAuthenticatorType,
		ClientID:                     &client.ClientId,
		ConsentRequired:              &client.ConsentRequired,
		Description:                  &client.Description,
		DirectAccessGrantsEnabled:    &client.DirectAccess,
		Enabled:                      &client.Enabled,
		FrontChannelLogout:           &client.FrontChannelLogout,
		FullScopeAllowed:             &client.FullScopeAllowed,
		ImplicitFlowEnabled:          &client.ImplicitFlowEnabled,
		Name:                         &client.Name,
		Origin:                       &client.Origin,
		Protocol:                     &client.Protocol,
		ProtocolMappers:              &protocolMappers,
		PublicClient:                 &client.PublicClient,
		RedirectURIs: &[]string{
			client.WebUrl + "/*",
		},
		RegistrationAccessToken:            &client.RegistrationAccessToken,
		RootURL:                            &client.WebUrl,
		AdminURL:                           &client.AdminUrl,
		BaseURL:                            &client.HomeUrl,
		Secret:                             &client.ClientSecret,
		ServiceAccountsEnabled:             &client.ServiceAccountEnabled,
		StandardFlowEnabled:                &client.StandardFlowEnabled,
		SurrogateAuthRequired:              &client.SurrogateAuthRequired,
		WebOrigins:                         &client.WebOrigins,
		AuthenticationFlowBindingOverrides: &client.AuthenticationFlowBindingOverrides,
	}

	// Set the admin URL to the web URL for backwards compatibility.
	// Before adding the admin URL field, the admin URL was the same as the web URL.
	if client.AdminUrl == "" {
		cl.AdminURL = &client.WebUrl
	}

	if len(client.RedirectUris) > 0 {
		cl.RedirectURIs = &client.RedirectUris
	}

	if client.ID != "" {
		cl.ID = &client.ID
	}

	return cl
}