Commit 5207439d authored by Tim's avatar Tim
Browse files

fix client scope mapping

parent 6936a620
Pipeline #714 failed with stages
in 18 seconds
......@@ -648,6 +648,25 @@ func (client *gocloak) CreateComponent(ctx context.Context, token, realm string,
return getID(resp), nil
}
func (client *gocloak) UpdateClientScopeProtocolMapper(ctx context.Context, token, realm string, clientScopeID, mapperID string, mapper *ProtocolMappers) (string, error) {
const errMessage = "could not create client"
/* fmt.Println("************************")
fmt.Println(mapper)
fmt.Println(client.getAdminRealmURL(realm, "client-scopes", clientScopeID, "protocol-mappers/models", mapperID))
fmt.Println("************************")
*/
resp, err := client.getRequestWithBearerAuth(ctx, token).
SetBody(mapper).
Put(client.getAdminRealmURL(realm, "client-scopes", clientScopeID, "protocol-mappers/models", mapperID))
if err := checkForError(resp, err, errMessage); err != nil {
return "", err
}
return getID(resp), nil
}
func (client *gocloak) CreateClient(ctx context.Context, token, realm string, newClient Client) (string, error) {
const errMessage = "could not create client"
......
......@@ -120,6 +120,9 @@ type GoCloak interface {
GetClientScope(ctx context.Context, token, realm, scopeID string) (*ClientScope, error)
// GetClientScopes returns all client scopes
GetClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
UpdateClientScopeProtocolMapper(ctx context.Context, token, realm string, clientScopeID, mapperID string, mapper *ProtocolMappers) (string, error)
// GetClientScopeMappings returns all scope mappings for the client
GetClientScopeMappings(ctx context.Context, token, realm, clientID string) (*MappingsRepresentation, error)
// GetClientScopeMappingsRealmRoles returns realm-level roles associated with the client’s scope
......
......@@ -372,12 +372,12 @@ type ClientScopeAttributes struct {
// ProtocolMappers are protocolmappers
type ProtocolMappers struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
ProtocolMapper *string `json:"protocolMapper,omitempty"`
ConsentRequired *bool `json:"consentRequired,omitempty"`
ProtocolMappersConfig *ProtocolMappersConfig `json:"config,omitempty"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
ProtocolMapper *string `json:"protocolMapper,omitempty"`
ConsentRequired *bool `json:"consentRequired,omitempty"`
ProtocolMappersConfig *map[string]string `json:"config,omitempty"`
}
// ProtocolMappersConfig is a config of a protocol mapper
......@@ -737,13 +737,14 @@ type RealmRepresentation struct {
SsoSessionIdleTimeoutRememberMe *int `json:"ssoSessionIdleTimeoutRememberMe,omitempty"`
SsoSessionMaxLifespan *int `json:"ssoSessionMaxLifespan,omitempty"`
SsoSessionMaxLifespanRememberMe *int `json:"ssoSessionMaxLifespanRememberMe,omitempty"`
SupportedLocales *[]string `json:"supportedLocales,omitempty"`
UserFederationMappers *[]interface{} `json:"userFederationMappers,omitempty"`
UserFederationProviders *[]interface{} `json:"userFederationProviders,omitempty"`
UserManagedAccessAllowed *bool `json:"userManagedAccessAllowed,omitempty"`
Users *[]User `json:"users,omitempty"`
VerifyEmail *bool `json:"verifyEmail,omitempty"`
WaitIncrementSeconds *int `json:"waitIncrementSeconds,omitempty"`
// SupportedLocales *map[int]string `json:"supportedLocales,omitempty"`
SupportedLocales *[]string `json:"supportedLocales,omitempty"`
UserFederationMappers *[]interface{} `json:"userFederationMappers,omitempty"`
UserFederationProviders *[]interface{} `json:"userFederationProviders,omitempty"`
UserManagedAccessAllowed *bool `json:"userManagedAccessAllowed,omitempty"`
Users *[]User `json:"users,omitempty"`
VerifyEmail *bool `json:"verifyEmail,omitempty"`
WaitIncrementSeconds *int `json:"waitIncrementSeconds,omitempty"`
}
// MultiValuedHashMap represents something
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment