gocloak

package module
v10.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 16 Imported by: 9

README

gocloak

codebeat badge Go Report Card Go Doc Build Status GitHub release codecov FOSSA Status

Golang Keycloak API Package

This client is based on: go-keycloak

For Questions either raise an issue, or come to the gopher-slack into the channel #gocloak

If u are using the echo framework have a look at gocloak-echo

Benchmarks can be found here

Contribution

(WIP) https://github.com/Nerzal/gocloak/wiki/Contribute

Changelog

V9
V9.0.4

Feature: #314 Add query parameter search to model GetClientsParams Feature: #313 Added ExactName param to GetSourceParams Feature: #312 Add support for client registration API Feature: #311 Add defaultRole to RealmRepresentation

V9.0.2

Bugfix: #305 Fix function signature of LoginClientTokenExchange function

V9.0.1

Breaking changes were introduced in #285 See: https://github.com/Nerzal/gocloak/pull/285/files

New Features:

  • #301 adding APIs handler to fetch policy resources
  • #299 GroupList Retrieval by RoleName
  • #296 Fixed incorrect json representation of ResourceType in PermissionRepresentation
  • #294 Remove duplicate quotes in README.md
  • #293 add IDPAlias IDPUserID query parameter to GetUsersParams
  • #290 Consent revocation endpoint
  • #288 Add support for token exchange login method

Bugifxes:

  • #287 bugfix: clear up id of client and client_id confusion
v8

Features:

  • Add DeleteIdentityProviderMapper and GetIdentityProviderMappers #273
  • Adding search by attributes client param #272
  • Add CreateIdentityProviderMapper call #268
  • Add ImportIdentityProviderConfig method #267
  • Added endpoint to support exporting public broker config info #266

Fixes:

  • adding "DecisionStrategy" to "ResourceServerRepresentation" #264
v7

Breaking Change

  • Added support for array values in aud claim
  • When decoding an access Token, it is now needed to provide the audience to check
  • Add member "MatchingURI" to GetResourceParams
  • Add resource policy functions (thanks to timdrysdale)
  • Add type field to APIError
  • Most of the protection API should now be implemented (thanks to timdrysdale)
v6

There are several backward incompatible changes

  • all client functions now take context.Context as first argument.
  • UserAttributeContains was moved from client method to package function.
  • all structures now use pointers for the array types ([]string -> *[]string)
v5

There is only one change, but it's backward incompatible:

  • Wrap Errors and use APIError struct to also provide the httpstatus code. (#146)
v4

There are a lot of backward incompatible changes:

  • all functions what create an object now return an ID of the created object. The return statement of those functions has been changed from (error) to (string, error)
  • All structures now use pointers instead of general types (bool -> *bool, string ->*string). It has been done to properly use omitempty tag, otherwise it was impossible to set a false value for any of the bool propertires.

Usage

Installation
go get github.com/Nerzal/10
Importing
 import "github.com/Nerzal/gocloak/v10"
Create New User
 client := gocloak.NewClient("https://mycool.keycloak.instance")
 ctx := context.Background()
 token, err := client.LoginAdmin(ctx, "user", "password", "realmName")
 if err != nil {
  panic("Something wrong with the credentials or url")
 }

 user := gocloak.User{
  FirstName: gocloak.StringP("Bob"),
  LastName:  gocloak.StringP("Uncle"),
  Email:     gocloak.StringP("something@really.wrong"),
  Enabled:   gocloak.BoolP(true),
  Username:  gocloak.StringP("CoolGuy"),
 }

 _, err = client.CreateUser(ctx, token.AccessToken, "realm", user)
 if err != nil {
  panic("Oh no!, failed to create user :(")
 }
Introspect Token
 client := gocloak.NewClient(hostname)
 ctx := context.Background()
 token, err := client.LoginClient(ctx, clientID, clientSecret, realm)
 if err != nil {
  panic("Login failed:"+ err.Error())
 }

 rptResult, err := client.RetrospectToken(ctx, token.AccessToken, clientID, clientSecret, realm)
 if err != nil {
  panic("Inspection failed:"+ err.Error())
 }

 if !rptResult.Active {
  panic("Token is not active")
 }

 permissions := rptResult.Permissions
 // Do something with the permissions ;)
Get Client id

Client has 2 identity fields- id and clientId and both are unique in one realm.

  • id is generated automatically by Keycloak.
  • clientId is configured by users in Add client page.

To get the clientId from id, use GetClients method with GetClientsParams{ClientID: &clientName}.

 clients, err := c.Client.GetClients(
  c.Ctx,
  c.JWT.AccessToken,
  c.Realm,
  gocloak.GetClientsParams{
   ClientID: &clientName,
  },
 )
 if err != nil {
  panic("List clients failed:"+ err.Error())
 }
 for _, client := range clients {
  return *client.ID, nil
 }

Features

// GoCloak holds all methods a client should fulfill
type GoCloak interface {

 RestyClient() *resty.Client
 SetRestyClient(restyClient *resty.Client)

 GetToken(ctx context.Context, realm string, options TokenOptions) (*JWT, error)
 GetRequestingPartyToken(ctx context.Context, token, realm string, options RequestingPartyTokenOptions) (*JWT, error)
 GetRequestingPartyPermissions(ctx context.Context, token, realm string, options RequestingPartyTokenOptions) (*[]RequestingPartyPermission, error)
 GetRequestingPartyPermissionDecision(ctx context.Context, token, realm string, options RequestingPartyTokenOptions) (*RequestingPartyPermissionDecision, error)

 Login(ctx context.Context, clientID, clientSecret, realm, username, password string) (*JWT, error)
 LoginOtp(ctx context.Context, clientID, clientSecret, realm, username, password, totp string) (*JWT, error)
 Logout(ctx context.Context, clientID, clientSecret, realm, refreshToken string) error
 LogoutPublicClient(ctx context.Context, clientID, realm, accessToken, refreshToken string) error
 LogoutAllSessions(ctx context.Context, accessToken, realm, userID string) error
 RevokeUserConsents(ctx context.Context, accessToken, realm, userID, clientID string) error
 LogoutUserSession(ctx context.Context, accessToken, realm, session string) error
 LoginClient(ctx context.Context, clientID, clientSecret, realm string) (*JWT, error)
 LoginClientSignedJWT(ctx context.Context, clientID, realm string, key interface{}, signedMethod jwt.SigningMethod, expiresAt *jwt.Time) (*JWT, error)
 LoginAdmin(ctx context.Context, username, password, realm string) (*JWT, error)
 RefreshToken(ctx context.Context, refreshToken, clientID, clientSecret, realm string) (*JWT, error)
 DecodeAccessToken(ctx context.Context, accessToken, realm, expectedAudience string) (*jwt.Token, *jwt.MapClaims, error)
 DecodeAccessTokenCustomClaims(ctx context.Context, accessToken, realm, expectedAudience string, claims jwt.Claims) (*jwt.Token, error)
 RetrospectToken(ctx context.Context, accessToken, clientID, clientSecret, realm string) (*RetrospecTokenResult, error)
 GetIssuer(ctx context.Context, realm string) (*IssuerResponse, error)
 GetCerts(ctx context.Context, realm string) (*CertResponse, error)
 GetServerInfo(ctx context.Context, accessToken string) (*ServerInfoRepesentation, error)
 GetUserInfo(ctx context.Context, accessToken, realm string) (*UserInfo, error)
 GetRawUserInfo(ctx context.Context, accessToken, realm string) (map[string]interface{}, error)
 SetPassword(ctx context.Context, token, userID, realm, password string, temporary bool) error
 ExecuteActionsEmail(ctx context.Context, token, realm string, params ExecuteActionsEmail) error

 CreateUser(ctx context.Context, token, realm string, user User) (string, error)
 CreateGroup(ctx context.Context, accessToken, realm string, group Group) (string, error)
 CreateChildGroup(ctx context.Context, token, realm, groupID string, group Group) (string, error)
 CreateClientRole(ctx context.Context, accessToken, realm, idOfClient string, role Role) (string, error)
 CreateClient(ctx context.Context, accessToken, realm string, newClient Client) (string, error)
 CreateClientScope(ctx context.Context, accessToken, realm string, scope ClientScope) (string, error)
 CreateComponent(ctx context.Context, accessToken, realm string, component Component) (string, error)
 CreateClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string, roles []Role) error
 CreateClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string, roles []Role) error
 CreateClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfCLientScope string, roles []Role) error

 UpdateUser(ctx context.Context, accessToken, realm string, user User) error
 UpdateGroup(ctx context.Context, accessToken, realm string, updatedGroup Group) error
 UpdateRole(ctx context.Context, accessToken, realm, idOfClient string, role Role) error
 UpdateClient(ctx context.Context, accessToken, realm string, updatedClient Client) error
 UpdateClientScope(ctx context.Context, accessToken, realm string, scope ClientScope) error

 DeleteUser(ctx context.Context, accessToken, realm, userID string) error
 DeleteComponent(ctx context.Context, accessToken, realm, componentID string) error
 DeleteGroup(ctx context.Context, accessToken, realm, groupID string) error
 DeleteClientRole(ctx context.Context, accessToken, realm, idOfClient, roleName string) error
 DeleteClientRoleFromUser(ctx context.Context, token, realm, idOfClient, userID string, roles []Role) error
 DeleteClient(ctx context.Context, accessToken, realm, idOfClient string) error
 DeleteClientScope(ctx context.Context, accessToken, realm, scopeID string) error
 DeleteClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string, roles []Role) error
 DeleteClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string, roles []Role) error
 DeleteClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfCLientScope string, roles []Role) error

 GetClient(ctx context.Context, accessToken, realm, idOfClient string) (*Client, error)
 GetClientsDefaultScopes(ctx context.Context, token, realm, idOfClient string) ([]*ClientScope, error)
 AddDefaultScopeToClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
 RemoveDefaultScopeFromClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
 GetClientsOptionalScopes(ctx context.Context, token, realm, idOfClient string) ([]*ClientScope, error)
 AddOptionalScopeToClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
 RemoveOptionalScopeFromClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
 GetDefaultOptionalClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
 GetDefaultDefaultClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
 GetClientScope(ctx context.Context, token, realm, scopeID string) (*ClientScope, error)
 GetClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
 GetClientScopeMappings(ctx context.Context, token, realm, idOfClient string) (*MappingsRepresentation, error)
 GetClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string) ([]*Role, error)
 GetClientScopeMappingsRealmRolesAvailable(ctx context.Context, token, realm, idOfClient string) ([]*Role, error)
 GetClientScopesScopeMappingsRealmRolesAvailable(ctx context.Context, token, realm, idOfClientScope string) ([]*Role, error)
 GetClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string) ([]*Role, error)
 GetClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClientScope string) ([]*Role, error)
 GetClientScopeMappingsClientRolesAvailable(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string) ([]*Role, error)
 GetClientSecret(ctx context.Context, token, realm, idOfClient string) (*CredentialRepresentation, error)
 GetClientServiceAccount(ctx context.Context, token, realm, idOfClient string) (*User, error)
 RegenerateClientSecret(ctx context.Context, token, realm, idOfClient string) (*CredentialRepresentation, error)
 GetKeyStoreConfig(ctx context.Context, accessToken, realm string) (*KeyStoreConfig, error)
 GetUserByID(ctx context.Context, accessToken, realm, userID string) (*User, error)
 GetUserCount(ctx context.Context, accessToken, realm string, params GetUsersParams) (int, error)
 GetUsers(ctx context.Context, accessToken, realm string, params GetUsersParams) ([]*User, error)
 GetUserGroups(ctx context.Context, accessToken, realm, userID string, params GetGroupsParams) ([]*UserGroup, error)
 AddUserToGroup(ctx context.Context, token, realm, userID, groupID string) error
 DeleteUserFromGroup(ctx context.Context, token, realm, userID, groupID string) error
 GetComponents(ctx context.Context, accessToken, realm string) ([]*Component, error)
 GetGroups(ctx context.Context, accessToken, realm string, params GetGroupsParams) ([]*Group, error)
 GetGroupsCount(ctx context.Context, token, realm string, params GetGroupsParams) (int, error)
 GetGroup(ctx context.Context, accessToken, realm, groupID string) (*Group, error)
 GetDefaultGroups(ctx context.Context, accessToken, realm string) ([]*Group, error)
 AddDefaultGroup(ctx context.Context, accessToken, realm, groupID string) error
 RemoveDefaultGroup(ctx context.Context, accessToken, realm, groupID string) error
 GetGroupMembers(ctx context.Context, accessToken, realm, groupID string, params GetGroupsParams) ([]*User, error)
 GetRoleMappingByGroupID(ctx context.Context, accessToken, realm, groupID string) (*MappingsRepresentation, error)
 GetRoleMappingByUserID(ctx context.Context, accessToken, realm, userID string) (*MappingsRepresentation, error)
 GetClientRoles(ctx context.Context, accessToken, realm, idOfClient string, params GetRoleParams) ([]*Role, error)
 GetClientRole(ctx context.Context, token, realm, idOfClient, roleName string) (*Role, error)
 GetClientRoleByID(ctx context.Context, accessToken, realm, roleID string) (*Role, error)
 GetClients(ctx context.Context, accessToken, realm string, params GetClientsParams) ([]*Client, error)
 AddClientRoleComposite(ctx context.Context, token, realm, roleID string, roles []Role) error
 DeleteClientRoleComposite(ctx context.Context, token, realm, roleID string, roles []Role) error
 GetUsersByRoleName(ctx context.Context, token, realm, roleName string) ([]*User, error)
 GetUsersByClientRoleName(ctx context.Context, token, realm, idOfClient, roleName string, params GetUsersByRoleParams) ([]*User, error)
 CreateClientProtocolMapper(ctx context.Context, token, realm, idOfClient string, mapper ProtocolMapperRepresentation) (string, error)
 UpdateClientProtocolMapper(ctx context.Context, token, realm, idOfClient, mapperID string, mapper ProtocolMapperRepresentation) error
 DeleteClientProtocolMapper(ctx context.Context, token, realm, idOfClient, mapperID string) error

 // *** Realm Roles ***

 CreateRealmRole(ctx context.Context, token, realm string, role Role) (string, error)
 GetRealmRole(ctx context.Context, token, realm, roleName string) (*Role, error)
 GetRealmRoles(ctx context.Context, accessToken, realm string, params GetRoleParams) ([]*Role, error)
 GetRealmRoleByID(ctx context.Context, token, realm, roleID string) (*Role, error)
 GetRealmRolesByUserID(ctx context.Context, accessToken, realm, userID string) ([]*Role, error)
 GetRealmRolesByGroupID(ctx context.Context, accessToken, realm, groupID string) ([]*Role, error)
 UpdateRealmRole(ctx context.Context, token, realm, roleName string, role Role) error
 UpdateRealmRoleByID(ctx context.Context, token, realm, roleID string, role Role) error
 DeleteRealmRole(ctx context.Context, token, realm, roleName string) error
 AddRealmRoleToUser(ctx context.Context, token, realm, userID string, roles []Role) error
 DeleteRealmRoleFromUser(ctx context.Context, token, realm, userID string, roles []Role) error
 AddRealmRoleToGroup(ctx context.Context, token, realm, groupID string, roles []Role) error
 DeleteRealmRoleFromGroup(ctx context.Context, token, realm, groupID string, roles []Role) error
 AddRealmRoleComposite(ctx context.Context, token, realm, roleName string, roles []Role) error
 DeleteRealmRoleComposite(ctx context.Context, token, realm, roleName string, roles []Role) error
 GetCompositeRealmRoles(ctx context.Context, token, realm, roleName string) ([]*Role, error)
 GetCompositeRealmRolesByRoleID(ctx context.Context, token, realm, roleID string) ([]*Role, error)
 GetCompositeRealmRolesByUserID(ctx context.Context, token, realm, userID string) ([]*Role, error)
 GetCompositeRealmRolesByGroupID(ctx context.Context, token, realm, groupID string) ([]*Role, error)
 GetAvailableRealmRolesByUserID(ctx context.Context, token, realm, userID string) ([]*Role, error)
 GetAvailableRealmRolesByGroupID(ctx context.Context, token, realm, groupID string) ([]*Role, error)

 // *** Client Roles ***

 AddClientRoleToUser(ctx context.Context, token, realm, idOfClient, userID string, roles []Role) error
 AddClientRoleToGroup(ctx context.Context, token, realm, idOfClient, groupID string, roles []Role) error
 DeleteClientRoleFromGroup(ctx context.Context, token, realm, idOfClient, groupID string, roles []Role) error
 GetCompositeClientRolesByRoleID(ctx context.Context, token, realm, idOfClient, roleID string) ([]*Role, error)
 GetClientRolesByUserID(ctx context.Context, token, realm, idOfClient, userID string) ([]*Role, error)
 GetClientRolesByGroupID(ctx context.Context, token, realm, idOfClient, groupID string) ([]*Role, error)
 GetCompositeClientRolesByUserID(ctx context.Context, token, realm, idOfClient, userID string) ([]*Role, error)
 GetCompositeClientRolesByGroupID(ctx context.Context, token, realm, idOfClient, groupID string) ([]*Role, error)
 GetAvailableClientRolesByUserID(ctx context.Context, token, realm, idOfClient, userID string) ([]*Role, error)
 GetAvailableClientRolesByGroupID(ctx context.Context, token, realm, idOfClient, groupID string) ([]*Role, error)

 // *** Realm ***

 GetRealm(ctx context.Context, token, realm string) (*RealmRepresentation, error)
 GetRealms(ctx context.Context, token string) ([]*RealmRepresentation, error)
 CreateRealm(ctx context.Context, token string, realm RealmRepresentation) (string, error)
 UpdateRealm(ctx context.Context, token string, realm RealmRepresentation) error
 DeleteRealm(ctx context.Context, token, realm string) error
 ClearRealmCache(ctx context.Context, token, realm string) error
 ClearUserCache(ctx context.Context, token, realm string) error
 ClearKeysCache(ctx context.Context, token, realm string) error

 GetClientUserSessions(ctx context.Context, token, realm, idOfClient string) ([]*UserSessionRepresentation, error)
 GetClientOfflineSessions(ctx context.Context, token, realm, idOfClient string) ([]*UserSessionRepresentation, error)
 GetUserSessions(ctx context.Context, token, realm, userID string) ([]*UserSessionRepresentation, error)
 GetUserOfflineSessionsForClient(ctx context.Context, token, realm, userID, idOfClient string) ([]*UserSessionRepresentation, error)

 // *** Protection API ***
 GetResource(ctx context.Context, token, realm, idOfClient, resourceID string) (*ResourceRepresentation, error)
 GetResources(ctx context.Context, token, realm, idOfClient string, params GetResourceParams) ([]*ResourceRepresentation, error)
 CreateResource(ctx context.Context, token, realm, idOfClient string, resource ResourceRepresentation) (*ResourceRepresentation, error)
 UpdateResource(ctx context.Context, token, realm, idOfClient string, resource ResourceRepresentation) error
 DeleteResource(ctx context.Context, token, realm, idOfClient, resourceID string) error

 GetResourceClient(ctx context.Context, token, realm, resourceID string) (*ResourceRepresentation, error)
 GetResourcesClient(ctx context.Context, token, realm string, params GetResourceParams) ([]*ResourceRepresentation, error)
 CreateResourceClient(ctx context.Context, token, realm string, resource ResourceRepresentation) (*ResourceRepresentation, error)
 UpdateResourceClient(ctx context.Context, token, realm string, resource ResourceRepresentation) error
 DeleteResourceClient(ctx context.Context, token, realm, resourceID string) error

 GetScope(ctx context.Context, token, realm, idOfClient, scopeID string) (*ScopeRepresentation, error)
 GetScopes(ctx context.Context, token, realm, idOfClient string, params GetScopeParams) ([]*ScopeRepresentation, error)
 CreateScope(ctx context.Context, token, realm, idOfClient string, scope ScopeRepresentation) (*ScopeRepresentation, error)
 UpdateScope(ctx context.Context, token, realm, idOfClient string, resource ScopeRepresentation) error
 DeleteScope(ctx context.Context, token, realm, idOfClient, scopeID string) error

 GetPolicy(ctx context.Context, token, realm, idOfClient, policyID string) (*PolicyRepresentation, error)
 GetPolicies(ctx context.Context, token, realm, idOfClient string, params GetPolicyParams) ([]*PolicyRepresentation, error)
 CreatePolicy(ctx context.Context, token, realm, idOfClient string, policy PolicyRepresentation) (*PolicyRepresentation, error)
 UpdatePolicy(ctx context.Context, token, realm, idOfClient string, policy PolicyRepresentation) error
 DeletePolicy(ctx context.Context, token, realm, idOfClient, policyID string) error

 GetResourcePolicy(ctx context.Context, token, realm, permissionID string) (*ResourcePolicyRepresentation, error)
 GetResourcePolicies(ctx context.Context, token, realm string, params GetResourcePoliciesParams) ([]*ResourcePolicyRepresentation, error)
 CreateResourcePolicy(ctx context.Context, token, realm, resourceID string, policy ResourcePolicyRepresentation) (*ResourcePolicyRepresentation, error)
 UpdateResourcePolicy(ctx context.Context, token, realm, permissionID string, policy ResourcePolicyRepresentation) error
 DeleteResourcePolicy(ctx context.Context, token, realm, permissionID string) error

 GetPermission(ctx context.Context, token, realm, idOfClient, permissionID string) (*PermissionRepresentation, error)
 GetPermissions(ctx context.Context, token, realm, idOfClient string, params GetPermissionParams) ([]*PermissionRepresentation, error)
 GetPermissionResources(ctx context.Context, token, realm, idOfClient, permissionID string) ([]*PermissionResource, error)
 GetPermissionScopes(ctx context.Context, token, realm, idOfClient, permissionID string) ([]*PermissionScope, error)
 GetDependentPermissions(ctx context.Context, token, realm, idOfClient, policyID string) ([]*PermissionRepresentation, error)
 CreatePermission(ctx context.Context, token, realm, idOfClient string, permission PermissionRepresentation) (*PermissionRepresentation, error)
 UpdatePermission(ctx context.Context, token, realm, idOfClient string, permission PermissionRepresentation) error
 DeletePermission(ctx context.Context, token, realm, idOfClient, permissionID string) error

 CreatePermissionTicket(ctx context.Context, token, realm string, permissions []CreatePermissionTicketParams) (*PermissionTicketResponseRepresentation, error)
 GrantUserPermission(ctx context.Context, token, realm string, permission PermissionGrantParams) (*PermissionGrantResponseRepresentation, error)
 UpdateUserPermission(ctx context.Context, token, realm string, permission PermissionGrantParams) (*PermissionGrantResponseRepresentation, error)
 GetUserPermissions(ctx context.Context, token, realm string, params GetUserPermissionParams) ([]*PermissionGrantResponseRepresentation, error)
 DeleteUserPermission(ctx context.Context, token, realm, ticketID string) error

 // *** Credentials API ***

 GetCredentialRegistrators(ctx context.Context, token, realm string) ([]string, error)
 GetConfiguredUserStorageCredentialTypes(ctx context.Context, token, realm, userID string) ([]string, error)
 GetCredentials(ctx context.Context, token, realm, UserID string) ([]*CredentialRepresentation, error)
 DeleteCredentials(ctx context.Context, token, realm, UserID, CredentialID string) error
 UpdateCredentialUserLabel(ctx context.Context, token, realm, userID, credentialID, userLabel string) error
 DisableAllCredentialsByType(ctx context.Context, token, realm, userID string, types []string) error
 MoveCredentialBehind(ctx context.Context, token, realm, userID, credentialID, newPreviousCredentialID string) error
 MoveCredentialToFirst(ctx context.Context, token, realm, userID, credentialID string) error

 // *** Identity Providers ***

 CreateIdentityProvider(ctx context.Context, token, realm string, providerRep IdentityProviderRepresentation) (string, error)
 GetIdentityProvider(ctx context.Context, token, realm, alias string) (*IdentityProviderRepresentation, error)
 GetIdentityProviders(ctx context.Context, token, realm string) ([]*IdentityProviderRepresentation, error)
 UpdateIdentityProvider(ctx context.Context, token, realm, alias string, providerRep IdentityProviderRepresentation) error
 DeleteIdentityProvider(ctx context.Context, token, realm, alias string) error

 CreateIdentityProviderMapper(ctx context.Context, token, realm, alias string, mapper IdentityProviderMapper) (string, error)
 GetIdentityProviderMapper(ctx context.Context, token string, realm string, alias string, mapperID string) (*IdentityProviderMapper, error)
 CreateUserFederatedIdentity(ctx context.Context, token, realm, userID, providerID string, federatedIdentityRep FederatedIdentityRepresentation) error
 GetUserFederatedIdentities(ctx context.Context, token, realm, userID string) ([]*FederatedIdentityRepresentation, error)
 DeleteUserFederatedIdentity(ctx context.Context, token, realm, userID, providerID string) error

 // *** Events API ***
 GetEvents(ctx context.Context, token string, realm string, params GetEventsParams) ([]*EventRepresentation, error)

}

Configure gocloak to skip TLS Insecure Verification

    client := gocloak.NewClient(serverURL)
    restyClient := client.RestyClient()
    restyClient.SetDebug(true)
    restyClient.SetTLSClientConfig(&tls.Config{ InsecureSkipVerify: true })

developing & testing

For local testing you need to start a docker container. Simply run following commands prior to starting the tests:

docker pull quay.io/keycloak/keycloak
docker run -d \
 -e KEYCLOAK_USER=admin \
 -e KEYCLOAK_PASSWORD=secret \
 -e KEYCLOAK_IMPORT=/tmp/gocloak-realm.json \
 -v "`pwd`/testdata/gocloak-realm.json:/tmp/gocloak-realm.json" \
 -p 8080:8080 \
 --name gocloak-test \
 quay.io/keycloak/keycloak:latest -Dkeycloak.profile.feature.upload_scripts=enabled

go test

Or you can run with docker compose using the run-tests script

./run-tests.sh

or

./run-tests.sh <TestCase>

Or you can run the tests on you own keycloak:

export GOCLOAK_TEST_CONFIG=/path/to/gocloak/config.json

All resources created as a result of unit tests will be deleted, except for the test user defined in the configuration file.

To remove running docker container after completion of tests:

docker stop gocloak-test
docker rm gocloak-test
Inspecting custom types

The custom types contain many pointers, so printing them yields mostly pointer values, which aren't much help when debugging your application. For example

someRealmRepresentation := gocloak.RealmRepresentation{
   <snip>
}

fmt.Println(someRealmRepresentation)

yields a large set of pointer values

{<nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> 0xc00000e960 <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> 0xc000093cf0 <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> null <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil> <nil>}

For convenience, the String() interface has been added so you can easily see the contents, even for nested custom types. For example,

fmt.Println(someRealmRepresentation.String())

yields

{
 "clients": [
  {
   "name": "someClient",
   "protocolMappers": [
    {
     "config": {
      "bar": "foo",
      "ping": "pong"
     },
     "name": "someMapper"
    }
   ]
  },
  {
   "name": "AnotherClient"
  }
 ],
 "displayName": "someRealm"
}

Note that empty parameters are not included, because of the use of omitempty in the type definitions.

License

FOSSA Status

GocloakSession

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ENFORCING  = PolicyEnforcementModeP("ENFORCING")
	PERMISSIVE = PolicyEnforcementModeP("PERMISSIVE")
	DISABLED   = PolicyEnforcementModeP("DISABLED")
)

PolicyEnforcementMode values

View Source
var (
	POSITIVE = LogicP("POSITIVE")
	NEGATIVE = LogicP("NEGATIVE")
)

Logic values

View Source
var (
	AFFIRMATIVE = DecisionStrategyP("AFFIRMATIVE")
	UNANIMOUS   = DecisionStrategyP("UNANIMOUS")
	CONSENSUS   = DecisionStrategyP("CONSENSUS")
)

DecisionStrategy values

Functions

func BoolP

func BoolP(value bool) *bool

BoolP returns a pointer of a boolean variable

func Float32P

func Float32P(value float32) *float32

Float32P returns a pointer of a float32 variable

func Float64P

func Float64P(value float64) *float64

Float64P returns a pointer of a float64 variable

func GetQueryParams

func GetQueryParams(s interface{}) (map[string]string, error)

GetQueryParams converts the struct to map[string]string The fields tags must have `json:"<name>,string,omitempty"` format for all types, except strings The string fields must have: `json:"<name>,omitempty"`. The `json:"<name>,string,omitempty"` tag for string field will add additional double quotes. "string" tag allows to convert the non-string fields of a structure to map[string]string. "omitempty" allows to skip the fields with default values.

func Int32P

func Int32P(value int32) *int32

Int32P returns a pointer of an int32 variable

func Int64P

func Int64P(value int64) *int64

Int64P returns a pointer of an int64 variable

func IntP

func IntP(value int) *int

IntP returns a pointer of an integer variable

func NilOrEmpty

func NilOrEmpty(value *string) bool

NilOrEmpty returns true if string is empty or has a nil value

func NilOrEmptyArray

func NilOrEmptyArray(value *[]string) bool

NilOrEmptyArray returns true if string is empty or has a nil value

func NilOrEmptySlice

func NilOrEmptySlice(value *[]string) bool

NilOrEmptySlice returns true if list is empty or has a nil value

func PBool

func PBool(value *bool) bool

PBool returns a boolean value from a pointer

func PFloat32

func PFloat32(value *float32) float32

PFloat32 returns an flaot32 value from a pointer

func PFloat64

func PFloat64(value *float64) float64

PFloat64 returns an flaot64 value from a pointer

func PInt

func PInt(value *int) int

PInt returns an integer value from a pointer

func PInt32

func PInt32(value *int32) int32

PInt32 returns an int32 value from a pointer

func PInt64

func PInt64(value *int64) int64

PInt64 returns an int64 value from a pointer

func PString

func PString(value *string) string

PString returns a string value from a pointer

func PStringSlice

func PStringSlice(value *[]string) []string

PStringSlice converts a pointer to []string or returns ampty slice if nill value

func SetAuthAdminRealms

func SetAuthAdminRealms(url string) func(client *gocloak)

SetAuthAdminRealms sets the auth admin realm

func SetAuthRealms

func SetAuthRealms(url string) func(client *gocloak)

SetAuthRealms sets the auth realm

func SetCertCacheInvalidationTime

func SetCertCacheInvalidationTime(duration time.Duration) func(client *gocloak)

SetCertCacheInvalidationTime sets the logout

func SetLogoutEndpoint

func SetLogoutEndpoint(url string) func(client *gocloak)

SetLogoutEndpoint sets the logout

func SetOpenIDConnectEndpoint

func SetOpenIDConnectEndpoint(url string) func(client *gocloak)

SetOpenIDConnectEndpoint sets the logout

func SetTokenEndpoint

func SetTokenEndpoint(url string) func(client *gocloak)

SetTokenEndpoint sets the token endpoint

func StringP

func StringP(value string) *string

StringP returns a pointer of a string variable

func UserAttributeContains

func UserAttributeContains(attributes map[string][]string, attribute, value string) bool

UserAttributeContains checks if the given attribute value is set

func WithTracer

func WithTracer(ctx context.Context, tracer opentracing.Tracer) context.Context

WithTracer generates a context that has a tracer attached

Types

type APIErrType

type APIErrType string

APIErrType is a field containing more specific API error types that may be checked by the receiver.

const (
	// APIErrTypeUnknown is for API errors that are not strongly
	// typed.
	APIErrTypeUnknown APIErrType = "unknown"

	// APIErrTypeInvalidGrant corresponds with Keycloak's
	// OAuthErrorException due to "invalid_grant".
	APIErrTypeInvalidGrant = "oauth: invalid grant"
)

func ParseAPIErrType

func ParseAPIErrType(err error) APIErrType

ParseAPIErrType is a convenience method for returning strongly typed API errors.

type APIError

type APIError struct {
	Code    int        `json:"code"`
	Message string     `json:"message"`
	Type    APIErrType `json:"type"`
}

APIError holds message and statusCode for api errors

func (APIError) Error

func (apiError APIError) Error() string

Error stringifies the APIError

type Access

type Access struct {
	ManageGroupMembership *bool `json:"manageGroupMembership,omitempty"`
	View                  *bool `json:"view,omitempty"`
	MapRoles              *bool `json:"mapRoles,omitempty"`
	Impersonate           *bool `json:"impersonate,omitempty"`
	Manage                *bool `json:"manage,omitempty"`
}

Access represents access

func (*Access) String

func (v *Access) String() string

type AccessRepresentation

type AccessRepresentation struct {
	ManageGroupMembership *bool `json:"manageGroupMembership,omitempty"`
	View                  *bool `json:"view,omitempty"`
	MapRoles              *bool `json:"mapRoles,omitempty"`
	Impersonate           *bool `json:"impersonate,omitempty"`
	Manage                *bool `json:"manage,omitempty"`
}

AccessRepresentation represents the access parameters returned in the permission ticket description

func (*AccessRepresentation) String

func (v *AccessRepresentation) String() string

type ActiveKeys

type ActiveKeys struct {
	HS256 *string `json:"HS256,omitempty"`
	RS256 *string `json:"RS256,omitempty"`
	AES   *string `json:"AES,omitempty"`
}

ActiveKeys holds the active keys

func (*ActiveKeys) String

func (v *ActiveKeys) String() string

type AdapterConfiguration

type AdapterConfiguration struct {
	Realm            *string     `json:"realm"`
	AuthServerURL    *string     `json:"auth-server-url"`
	SSLRequired      *string     `json:"ssl-required"`
	Resource         *string     `json:"resource"`
	Credentials      interface{} `json:"credentials"`
	ConfidentialPort *int        `json:"confidential-port"`
}

AdapterConfiguration represents adapter configuration of a client

type AggregatedPolicyRepresentation

type AggregatedPolicyRepresentation struct {
	Policies *[]string `json:"policies,omitempty"`
}

AggregatedPolicyRepresentation represents aggregated policies

func (*AggregatedPolicyRepresentation) String

type Attributes

type Attributes struct {
	LDAPENTRYDN *[]string `json:"LDAP_ENTRY_DN,omitempty"`
	LDAPID      *[]string `json:"LDAP_ID,omitempty"`
}

Attributes holds Attributes

func (*Attributes) String

func (v *Attributes) String() string

type AuthenticationExecutionRepresentation

type AuthenticationExecutionRepresentation struct {
	Authenticator       *string `json:"authenticator,omitempty"`
	AuthenticatorConfig *string `json:"authenticatorConfig,omitempty"`
	AuthenticatorFlow   *bool   `json:"authenticatorFlow,omitempty"`
	AutheticatorFlow    *bool   `json:"autheticatorFlow,omitempty"`
	FlowAlias           *string `json:"flowAlias,omitempty"`
	Priority            *int    `json:"priority,omitempty"`
	Requirement         *string `json:"requirement,omitempty"`
	UserSetupAllowed    *bool   `json:"userSetupAllowed,omitempty"`
}

AuthenticationExecutionRepresentation represents the authentication execution of an AuthenticationFlowRepresentation

type AuthenticationFlowRepresentation

type AuthenticationFlowRepresentation struct {
	Alias                    *string                                  `json:"alias,omitempty"`
	AuthenticationExecutions *[]AuthenticationExecutionRepresentation `json:"authenticationExecutions,omitempty"`
	BuiltIn                  *bool                                    `json:"builtIn,omitempty"`
	Description              *string                                  `json:"description,omitempty"`
	ID                       *string                                  `json:"id,omitempty"`
	ProviderID               *string                                  `json:"providerId,omitempty"`
	TopLevel                 *bool                                    `json:"topLevel,omitempty"`
}

AuthenticationFlowRepresentation represents an authentication flow of a realm

type CertResponse

type CertResponse struct {
	Keys *[]CertResponseKey `json:"keys,omitempty"`
}

CertResponse is returned by the certs endpoint

func (*CertResponse) String

func (v *CertResponse) String() string

type CertResponseKey

type CertResponseKey struct {
	Kid     *string   `json:"kid,omitempty"`
	Kty     *string   `json:"kty,omitempty"`
	Alg     *string   `json:"alg,omitempty"`
	Use     *string   `json:"use,omitempty"`
	N       *string   `json:"n,omitempty"`
	E       *string   `json:"e,omitempty"`
	KeyOps  *[]string `json:"key_ops,omitempty"`
	X5u     *string   `json:"x5u,omitempty"`
	X5c     *[]string `json:"x5c,omitempty"`
	X5t     *string   `json:"x5t,omitempty"`
	X5tS256 *string   `json:"x5t#S256,omitempty"`
}

CertResponseKey is returned by the certs endpoint. JSON Web Key structure is described here: https://self-issued.info/docs/draft-ietf-jose-json-web-key.html#JWKContents

func (*CertResponseKey) String

func (v *CertResponseKey) String() string

Stringer implementations for all struct types

type Client

type Client struct {
	Access                             *map[string]interface{}         `json:"access,omitempty"`
	AdminURL                           *string                         `json:"adminUrl,omitempty"`
	Attributes                         *map[string]string              `json:"attributes,omitempty"`
	AuthenticationFlowBindingOverrides *map[string]string              `json:"authenticationFlowBindingOverrides,omitempty"`
	AuthorizationServicesEnabled       *bool                           `json:"authorizationServicesEnabled,omitempty"`
	AuthorizationSettings              *ResourceServerRepresentation   `json:"authorizationSettings,omitempty"`
	BaseURL                            *string                         `json:"baseUrl,omitempty"`
	BearerOnly                         *bool                           `json:"bearerOnly,omitempty"`
	ClientAuthenticatorType            *string                         `json:"clientAuthenticatorType,omitempty"`
	ClientID                           *string                         `json:"clientId,omitempty"`
	ConsentRequired                    *bool                           `json:"consentRequired,omitempty"`
	DefaultClientScopes                *[]string                       `json:"defaultClientScopes,omitempty"`
	DefaultRoles                       *[]string                       `json:"defaultRoles,omitempty"`
	Description                        *string                         `json:"description,omitempty"`
	DirectAccessGrantsEnabled          *bool                           `json:"directAccessGrantsEnabled,omitempty"`
	Enabled                            *bool                           `json:"enabled,omitempty"`
	FrontChannelLogout                 *bool                           `json:"frontchannelLogout,omitempty"`
	FullScopeAllowed                   *bool                           `json:"fullScopeAllowed,omitempty"`
	ID                                 *string                         `json:"id,omitempty"`
	ImplicitFlowEnabled                *bool                           `json:"implicitFlowEnabled,omitempty"`
	Name                               *string                         `json:"name,omitempty"`
	NodeReRegistrationTimeout          *int32                          `json:"nodeReRegistrationTimeout,omitempty"`
	NotBefore                          *int32                          `json:"notBefore,omitempty"`
	OptionalClientScopes               *[]string                       `json:"optionalClientScopes,omitempty"`
	Origin                             *string                         `json:"origin,omitempty"`
	Protocol                           *string                         `json:"protocol,omitempty"`
	ProtocolMappers                    *[]ProtocolMapperRepresentation `json:"protocolMappers,omitempty"`
	PublicClient                       *bool                           `json:"publicClient,omitempty"`
	RedirectURIs                       *[]string                       `json:"redirectUris,omitempty"`
	RegisteredNodes                    *map[string]string              `json:"registeredNodes,omitempty"`
	RegistrationAccessToken            *string                         `json:"registrationAccessToken,omitempty"`
	RootURL                            *string                         `json:"rootUrl,omitempty"`
	Secret                             *string                         `json:"secret,omitempty"`
	ServiceAccountsEnabled             *bool                           `json:"serviceAccountsEnabled,omitempty"`
	StandardFlowEnabled                *bool                           `json:"standardFlowEnabled,omitempty"`
	SurrogateAuthRequired              *bool                           `json:"surrogateAuthRequired,omitempty"`
	WebOrigins                         *[]string                       `json:"webOrigins,omitempty"`
}

Client is a ClientRepresentation

func (*Client) String

func (v *Client) String() string

type ClientMappingsRepresentation

type ClientMappingsRepresentation struct {
	ID       *string `json:"id,omitempty"`
	Client   *string `json:"client,omitempty"`
	Mappings *[]Role `json:"mappings,omitempty"`
}

ClientMappingsRepresentation is a client role mappings

func (*ClientMappingsRepresentation) String

type ClientPolicyRepresentation

type ClientPolicyRepresentation struct {
	Clients *[]string `json:"clients,omitempty"`
}

ClientPolicyRepresentation represents client based policies

func (*ClientPolicyRepresentation) String

func (v *ClientPolicyRepresentation) String() string

type ClientScope

type ClientScope struct {
	ID                    *string                `json:"id,omitempty"`
	Name                  *string                `json:"name,omitempty"`
	Description           *string                `json:"description,omitempty"`
	Protocol              *string                `json:"protocol,omitempty"`
	ClientScopeAttributes *ClientScopeAttributes `json:"attributes,omitempty"`
	ProtocolMappers       *[]ProtocolMappers     `json:"protocolMappers,omitempty"`
}

ClientScope is a ClientScope

func (*ClientScope) String

func (v *ClientScope) String() string

type ClientScopeAttributes

type ClientScopeAttributes struct {
	ConsentScreenText      *string `json:"consent.screen.text,omitempty"`
	DisplayOnConsentScreen *string `json:"display.on.consent.screen,omitempty"`
	IncludeInTokenScope    *string `json:"include.in.token.scope,omitempty"`
}

ClientScopeAttributes are attributes of client scopes

func (*ClientScopeAttributes) String

func (v *ClientScopeAttributes) String() string

type Component

type Component struct {
	ID              *string          `json:"id,omitempty"`
	Name            *string          `json:"name,omitempty"`
	ProviderID      *string          `json:"providerId,omitempty"`
	ProviderType    *string          `json:"providerType,omitempty"`
	ParentID        *string          `json:"parentId,omitempty"`
	ComponentConfig *ComponentConfig `json:"config,omitempty"`
	SubType         *string          `json:"subType,omitempty"`
}

Component is a component

func (*Component) String

func (v *Component) String() string

type ComponentConfig

type ComponentConfig struct {
	Priority  *[]string `json:"priority,omitempty"`
	Algorithm *[]string `json:"algorithm,omitempty"`
}

ComponentConfig is a componentconfig

func (*ComponentConfig) String

func (v *ComponentConfig) String() string

type CompositesRepresentation

type CompositesRepresentation struct {
	Client *map[string][]string `json:"client,omitempty"`
	Realm  *[]string            `json:"realm,omitempty"`
}

CompositesRepresentation represents the composite roles of a role

func (*CompositesRepresentation) String

func (v *CompositesRepresentation) String() string

type CreateAuthenticationExecutionRepresentation

type CreateAuthenticationExecutionRepresentation struct {
	Provider *string `json:"provider,omitempty"`
}

CreateAuthenticationExecutionRepresentation contains the provider to be used for a new authentication representation

type CreatePermissionTicketParams

type CreatePermissionTicketParams struct {
	ResourceID     *string              `json:"resource_id,omitempty"`
	ResourceScopes *[]string            `json:"resource_scopes,omitempty"`
	Claims         *map[string][]string `json:"claims,omitempty"`
}

CreatePermissionTicketParams represents the optional parameters for getting a permission ticket

func (*CreatePermissionTicketParams) String

type CredentialRepresentation

type CredentialRepresentation struct {
	// Common part
	CreatedDate *int64  `json:"createdDate,omitempty"`
	Temporary   *bool   `json:"temporary,omitempty"`
	Type        *string `json:"type,omitempty"`
	Value       *string `json:"value,omitempty"`

	// <= v7
	Algorithm         *string             `json:"algorithm,omitempty"`
	Config            *MultiValuedHashMap `json:"config,omitempty"`
	Counter           *int32              `json:"counter,omitempty"`
	Device            *string             `json:"device,omitempty"`
	Digits            *int32              `json:"digits,omitempty"`
	HashIterations    *int32              `json:"hashIterations,omitempty"`
	HashedSaltedValue *string             `json:"hashedSaltedValue,omitempty"`
	Period            *int32              `json:"period,omitempty"`
	Salt              *string             `json:"salt,omitempty"`

	// >= v8
	CredentialData *string `json:"credentialData,omitempty"`
	ID             *string `json:"id,omitempty"`
	Priority       *int32  `json:"priority,omitempty"`
	SecretData     *string `json:"secretData,omitempty"`
	UserLabel      *string `json:"userLabel,omitempty"`
}

CredentialRepresentation is a representations of the credentials v7: https://www.keycloak.org/docs-api/7.0/rest-api/index.html#_credentialrepresentation v8: https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_credentialrepresentation

func (*CredentialRepresentation) String

func (v *CredentialRepresentation) String() string

type DecisionStrategy

type DecisionStrategy string

DecisionStrategy is an enum type for DecisionStrategy of PolicyRepresentation

func DecisionStrategyP

func DecisionStrategyP(value DecisionStrategy) *DecisionStrategy

DecisionStrategyP returns a pointer for a DecisionStrategy value

type EventRepresentation

type EventRepresentation struct {
	Time      int64             `json:"time,omitempty"`
	Type      *string           `json:"type,omitempty"`
	RealmID   *string           `json:"realmId,omitempty"`
	ClientID  *string           `json:"clientId,omitempty"`
	UserID    *string           `json:"userId,omitempty"`
	SessionID *string           `json:"sessionId,omitempty"`
	IPAddress *string           `json:"ipAddress,omitempty"`
	Details   map[string]string `json:"details,omitempty"`
}

EventRepresentation is a representation of a Event

type ExecuteActionsEmail

type ExecuteActionsEmail struct {
	UserID      *string   `json:"-"`
	ClientID    *string   `json:"client_id,omitempty"`
	Lifespan    *int      `json:"lifespan,string,omitempty"`
	RedirectURI *string   `json:"redirect_uri,omitempty"`
	Actions     *[]string `json:"-"`
}

ExecuteActionsEmail represents parameters for executing action emails

func (*ExecuteActionsEmail) String

func (v *ExecuteActionsEmail) String() string

type FederatedIdentityRepresentation

type FederatedIdentityRepresentation struct {
	IdentityProvider *string `json:"identityProvider,omitempty"`
	UserID           *string `json:"userId,omitempty"`
	UserName         *string `json:"userName,omitempty"`
}

FederatedIdentityRepresentation represents an user federated identity

func (*FederatedIdentityRepresentation) String

type GetClientsParams

type GetClientsParams struct {
	ClientID             *string `json:"clientId,omitempty"`
	ViewableOnly         *bool   `json:"viewableOnly,string,omitempty"`
	First                *int    `json:"first,string,omitempty"`
	Max                  *int    `json:"max,string,omitempty"`
	Search               *bool   `json:"search,string,omitempty"`
	SearchableAttributes *string `json:"q,omitempty"`
}

GetClientsParams represents the query parameters

func (*GetClientsParams) String

func (v *GetClientsParams) String() string

type GetEventsParams

type GetEventsParams struct {
	Client    *string  `json:"client,omitempty"`
	DateFrom  *string  `json:"dateFrom,omitempty"`
	DateTo    *string  `json:"dateTo,omitempty"`
	First     *int32   `json:"first,omitempty"`
	IPAddress *string  `json:"ipAddress,omitempty"`
	Max       *int32   `json:"max,omitempty"`
	Type      []string `json:"type,omitempty"`
	UserID    *string  `json:"user,omitempty"`
}

GetEventsParams represents the optional parameters for getting events

type GetGroupsParams

type GetGroupsParams struct {
	First               *int    `json:"first,string,omitempty"`
	Max                 *int    `json:"max,string,omitempty"`
	Search              *string `json:"search,omitempty"`
	Full                *bool   `json:"full,string,omitempty"`
	BriefRepresentation *bool   `json:"briefRepresentation,string,omitempty"`
}

GetGroupsParams represents the optional parameters for getting groups

func (GetGroupsParams) MarshalJSON

func (obj GetGroupsParams) MarshalJSON() ([]byte, error)

MarshalJSON is a custom json marshaling function to automatically set the Full and BriefRepresentation properties for backward compatibility

func (*GetGroupsParams) String

func (obj *GetGroupsParams) String() string

type GetPermissionParams

type GetPermissionParams struct {
	First    *int    `json:"first,string,omitempty"`
	Max      *int    `json:"max,string,omitempty"`
	Name     *string `json:"name,omitempty"`
	Resource *string `json:"resource,omitempty"`
	Scope    *string `json:"scope,omitempty"`
	Type     *string `json:"type,omitempty"`
}

GetPermissionParams represents the optional parameters for getting permissions

func (*GetPermissionParams) String

func (v *GetPermissionParams) String() string

type GetPolicyParams

type GetPolicyParams struct {
	First      *int    `json:"first,string,omitempty"`
	Max        *int    `json:"max,string,omitempty"`
	Name       *string `json:"name,omitempty"`
	Permission *bool   `json:"permission,string,omitempty"`
	Type       *string `json:"type,omitempty"`
}

GetPolicyParams represents the optional parameters for getting policies TODO: more policy params?

func (*GetPolicyParams) String

func (v *GetPolicyParams) String() string

type GetResourceParams

type GetResourceParams struct {
	Deep        *bool   `json:"deep,string,omitempty"`
	First       *int    `json:"first,string,omitempty"`
	Max         *int    `json:"max,string,omitempty"`
	Name        *string `json:"name,omitempty"`
	Owner       *string `json:"owner,omitempty"`
	Type        *string `json:"type,omitempty"`
	URI         *string `json:"uri,omitempty"`
	Scope       *string `json:"scope,omitempty"`
	MatchingURI *bool   `json:"matchingUri,string,omitempty"`
	ExactName   *bool   `json:"exactName,string,omitempty"`
}

GetResourceParams represents the optional parameters for getting resources

func (*GetResourceParams) String

func (v *GetResourceParams) String() string

type GetResourcePoliciesParams

type GetResourcePoliciesParams struct {
	ResourceID *string `json:"resource_id,omitempty"`
	Name       *string `json:"name,omitempty"`
	Scope      *string `json:"scope,omitempty"`
	First      *int    `json:"first,string,omitempty"`
	Max        *int    `json:"max,string,omitempty"`
}

GetResourcePoliciesParams is a representation of the query params for getting policies

func (*GetResourcePoliciesParams) String

func (v *GetResourcePoliciesParams) String() string

type GetRoleParams

type GetRoleParams struct {
	First               *int    `json:"first,string,omitempty"`
	Max                 *int    `json:"max,string,omitempty"`
	Search              *string `json:"search,omitempty"`
	BriefRepresentation *bool   `json:"briefRepresentation,string,omitempty"`
}

GetRoleParams represents the optional parameters for getting roles

func (*GetRoleParams) String

func (v *GetRoleParams) String() string

type GetScopeParams

type GetScopeParams struct {
	Deep  *bool   `json:"deep,string,omitempty"`
	First *int    `json:"first,string,omitempty"`
	Max   *int    `json:"max,string,omitempty"`
	Name  *string `json:"name,omitempty"`
}

GetScopeParams represents the optional parameters for getting scopes

func (*GetScopeParams) String

func (v *GetScopeParams) String() string

type GetUserPermissionParams

type GetUserPermissionParams struct {
	ScopeID     *string `json:"scopeId,omitempty"`
	ResourceID  *string `json:"resourceId,omitempty"`
	Owner       *string `json:"owner,omitempty"`
	Requester   *string `json:"requester,omitempty"`
	Granted     *bool   `json:"granted,omitempty"`
	ReturnNames *string `json:"returnNames,omitempty"`
	First       *int    `json:"first,string,omitempty"`
	Max         *int    `json:"max,string,omitempty"`
}

GetUserPermissionParams represents the optional parameters for getting user permissions

func (*GetUserPermissionParams) String

func (v *GetUserPermissionParams) String() string

type GetUsersByRoleParams

type GetUsersByRoleParams struct {
	First *int `json:"first,string,omitempty"`
	Max   *int `json:"max,string,omitempty"`
}

GetUsersByRoleParams represents the optional parameters for getting users by role

func (*GetUsersByRoleParams) String

func (v *GetUsersByRoleParams) String() string

type GetUsersParams

type GetUsersParams struct {
	BriefRepresentation *bool   `json:"briefRepresentation,string,omitempty"`
	Email               *string `json:"email,omitempty"`
	Enabled             *bool   `json:"enabled,string,omitempty"`
	Exact               *bool   `json:"exact,string,omitempty"`
	First               *int    `json:"first,string,omitempty"`
	FirstName           *string `json:"firstName,omitempty"`
	IDPAlias            *string `json:"idpAlias,omitempty"`
	IDPUserID           *string `json:"idpUserId,omitempty"`
	LastName            *string `json:"lastName,omitempty"`
	Max                 *int    `json:"max,string,omitempty"`
	Search              *string `json:"search,omitempty"`
	Username            *string `json:"username,omitempty"`
}

GetUsersParams represents the optional parameters for getting users

func (*GetUsersParams) String

func (v *GetUsersParams) String() string

type GoCloak

type GoCloak interface {
	// RestyClient returns a resty client that gocloak uses
	RestyClient() *resty.Client
	// Sets the resty Client that gocloak uses
	SetRestyClient(restyClient *resty.Client)

	// GetToken returns a token
	GetToken(ctx context.Context, realm string, options TokenOptions) (*JWT, error)
	// GetRequestingPartyToken returns a requesting party token with permissions granted by the server
	GetRequestingPartyToken(ctx context.Context, token, realm string, options RequestingPartyTokenOptions) (*JWT, error)
	// GetRequestingPartyPermissions returns a permissions granted by the server to requesting party
	GetRequestingPartyPermissions(ctx context.Context, token, realm string, options RequestingPartyTokenOptions) (*[]RequestingPartyPermission, error)
	// GetRequestingPartyPermissionDecision returns a permission decision granted by the server to requesting party
	GetRequestingPartyPermissionDecision(ctx context.Context, token, realm string, options RequestingPartyTokenOptions) (*RequestingPartyPermissionDecision, error)
	// Login sends a request to the token endpoint using user and client credentials
	Login(ctx context.Context, clientID, clientSecret, realm, username, password string) (*JWT, error)
	// LoginOtp performs a login with user credentials and otp token
	LoginOtp(ctx context.Context, clientID, clientSecret, realm, username, password, totp string) (*JWT, error)
	// Logout sends a request to the logout endpoint using refresh token
	Logout(ctx context.Context, clientID, clientSecret, realm, refreshToken string) error
	// LogoutPublicClient sends a request to the logout endpoint using refresh token
	LogoutPublicClient(ctx context.Context, idOfClient, realm, accessToken, refreshToken string) error
	// LogoutAllSessions logs out all sessions of a user given an id
	LogoutAllSessions(ctx context.Context, accessToken, realm, userID string) error
	// RevokeConsents revoke consent and offline tokens for particular client from user
	RevokeUserConsents(ctx context.Context, accessToken, realm, userID, clientID string) error
	// LogoutUserSessions logs out a single sessions of a user given a session id.
	// NOTE: this uses bearer token, but this token must belong to a user with proper privileges
	LogoutUserSession(ctx context.Context, accessToken, realm, session string) error
	// LoginClient sends a request to the token endpoint using client credentials
	LoginClient(ctx context.Context, clientID, clientSecret, realm string) (*JWT, error)
	// LoginClientTokenExchange requests a login on a specified users behalf. Returning a user's tokens.
	LoginClientTokenExchange(ctx context.Context, clientID, token, clientSecret, realm, targetClient, userID string) (*JWT, error)
	// LoginClientSignedJWT performs a login with client credentials and signed jwt claims
	LoginClientSignedJWT(ctx context.Context, idOfClient, realm string, key interface{}, signedMethod jwt.SigningMethod, expiresAt *jwt.NumericDate) (*JWT, error)
	// LoginAdmin login as admin
	LoginAdmin(ctx context.Context, username, password, realm string) (*JWT, error)
	// RefreshToken used to refresh the token
	RefreshToken(ctx context.Context, refreshToken, clientID, clientSecret, realm string) (*JWT, error)
	// DecodeAccessToken decodes the accessToken
	DecodeAccessToken(ctx context.Context, accessToken, realm string) (*jwt.Token, *jwt.MapClaims, error)
	// DecodeAccessTokenCustomClaims decodes the accessToken and fills the given claims
	DecodeAccessTokenCustomClaims(ctx context.Context, accessToken, realm string, claims jwt.Claims) (*jwt.Token, error)
	// RetrospectToken calls the openid-connect introspect endpoint
	RetrospectToken(ctx context.Context, accessToken, clientID, clientSecret, realm string) (*RetrospecTokenResult, error)
	// GetIssuer calls the issuer endpoint for the given realm
	GetIssuer(ctx context.Context, realm string) (*IssuerResponse, error)
	// GetCerts gets the public keys for the given realm
	GetCerts(ctx context.Context, realm string) (*CertResponse, error)
	// GetServerInfo returns the server info
	GetServerInfo(ctx context.Context, accessToken string) (*ServerInfoRepesentation, error)
	// GetUserInfo gets the user info for the given realm
	GetUserInfo(ctx context.Context, accessToken, realm string) (*UserInfo, error)
	// GetRawUserInfo calls the UserInfo endpoint and returns a raw json object
	GetRawUserInfo(ctx context.Context, accessToken, realm string) (map[string]interface{}, error)

	// ExecuteActionsEmail executes an actions email
	ExecuteActionsEmail(ctx context.Context, token, realm string, params ExecuteActionsEmail) error

	// CreateGroup creates a new group
	CreateGroup(ctx context.Context, accessToken, realm string, group Group) (string, error)
	// CreateChildGroup creates a new child group
	CreateChildGroup(ctx context.Context, token, realm, groupID string, group Group) (string, error)
	// CreateClient creates a new client
	CreateClient(ctx context.Context, accessToken, realm string, newClient Client) (string, error)
	// CreateClientScope creates a new clientScope
	CreateClientScope(ctx context.Context, accessToken, realm string, scope ClientScope) (string, error)
	// CreateComponent creates a new component
	CreateComponent(ctx context.Context, accessToken, realm string, component Component) (string, error)
	// CreateClientScopeMappingsRealmRoles creates realm-level roles to the client’s scope
	CreateClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string, roles []Role) error
	// CreateClientScopeMappingsClientRoles creates client-level roles from the client’s scope
	CreateClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string, roles []Role) error
	// CreateClientScopesScopeMappingsRealmRoles creates realm-level roles to the client-scope
	CreateClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClientScope string, roles []Role) error
	// CreateClientRepresentation creates a new client representation
	CreateClientRepresentation(ctx context.Context, realm string) (*Client, error)

	// UpdateGroup updates the given group
	UpdateGroup(ctx context.Context, accessToken, realm string, updatedGroup Group) error
	// UpdateRole updates the given role
	UpdateRole(ctx context.Context, accessToken, realm, idOfClient string, role Role) error
	// UpdateClient updates the given client
	UpdateClient(ctx context.Context, accessToken, realm string, updatedClient Client) error
	// UpdateClientScope updates the given clientScope
	UpdateClientScope(ctx context.Context, accessToken, realm string, scope ClientScope) error
	// UpdateClientRepresentation updates the given client representation
	UpdateClientRepresentation(ctx context.Context, accessToken, realm string, updatedClient Client) (*Client, error)

	// DeleteComponent deletes the given component
	DeleteComponent(ctx context.Context, accessToken, realm, componentID string) error
	// DeleteGroup deletes the given group
	DeleteGroup(ctx context.Context, accessToken, realm, groupID string) error
	// DeleteClient deletes the given client
	DeleteClient(ctx context.Context, accessToken, realm, idOfClient string) error
	// DeleteClientScope
	DeleteClientScope(ctx context.Context, accessToken, realm, scopeID string) error
	// DeleteClientScopeMappingsRealmRoles deletes realm-level roles from the client’s scope
	DeleteClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string, roles []Role) error
	// DeleteClientScopeMappingsClientRoles deletes client-level roles from the client’s scope
	DeleteClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string, roles []Role) error
	// DeleteClientScopesScopeMappingsRealmRoles deletes realm-level roles from the client-scope
	DeleteClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClientScope string, roles []Role) error
	// DeleteClientRepresentation deletes a given client representation
	DeleteClientRepresentation(ctx context.Context, accessToken, realm, clientID string) error

	// GetClient returns a client
	GetClient(ctx context.Context, accessToken, realm, idOfClient string) (*Client, error)
	// GetClientsDefaultScopes returns a list of the client's default scopes
	GetClientsDefaultScopes(ctx context.Context, token, realm, idOfClient string) ([]*ClientScope, error)
	// AddDefaultScopeToClient adds a client scope to the list of client's default scopes
	AddDefaultScopeToClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
	// RemoveDefaultScopeFromClient removes a client scope from the list of client's default scopes
	RemoveDefaultScopeFromClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
	// GetClientsOptionalScopes returns a list of the client's optional scopes
	GetClientsOptionalScopes(ctx context.Context, token, realm, idOfClient string) ([]*ClientScope, error)
	// AddOptionalScopeToClient adds a client scope to the list of client's optional scopes
	AddOptionalScopeToClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
	// RemoveOptionalScopeFromClient deletes a client scope from the list of client's optional scopes
	RemoveOptionalScopeFromClient(ctx context.Context, token, realm, idOfClient, scopeID string) error
	// GetDefaultOptionalClientScopes returns a list of default realm optional scopes
	GetDefaultOptionalClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
	// GetDefaultDefaultClientScopes returns a list of default realm default scopes
	GetDefaultDefaultClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
	// GetClientScope returns a clientscope
	GetClientScope(ctx context.Context, token, realm, scopeID string) (*ClientScope, error)
	// GetClientScopes returns all client scopes
	GetClientScopes(ctx context.Context, token, realm string) ([]*ClientScope, error)
	// GetClientScopeMappings returns all scope mappings for the client
	GetClientScopeMappings(ctx context.Context, token, realm, idOfClient string) (*MappingsRepresentation, error)
	// GetClientScopeMappingsRealmRoles returns realm-level roles associated with the client’s scope
	GetClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string) ([]*Role, error)
	// GetClientScopeMappingsRealmRolesAvailable returns realm-level roles that are available to attach to this client’s scope
	GetClientScopeMappingsRealmRolesAvailable(ctx context.Context, token, realm, idOfClient string) ([]*Role, error)
	// GetClientScopesScopeMappingsRealmRolesAvailable returns realm-level roles that are available to attach to this client-scope
	GetClientScopesScopeMappingsRealmRolesAvailable(ctx context.Context, token, realm, idOfClientScope string) ([]*Role, error)
	// GetClientScopeMappingsClientRoles returns roles associated with a client’s scope
	GetClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string) ([]*Role, error)
	// GetClientScopesScopeMappingsRealmRoles returns roles associated with a client-scope
	GetClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClientScope string) ([]*Role, error)
	// GetClientScopeMappingsClientRolesAvailable returns available roles associated with a client’s scope
	GetClientScopeMappingsClientRolesAvailable(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string) ([]*Role, error)
	// GetClientSecret returns a client's secret
	GetClientSecret(ctx context.Context, token, realm, idOfClient string) (*CredentialRepresentation, error)
	// GetClientServiceAccount retrieves the service account "user" for a client if enabled
	GetClientServiceAccount(ctx context.Context, token, realm, idOfClient string) (*User, error)
	// RegenerateClientSecret creates a new client secret returning the updated CredentialRepresentation
	RegenerateClientSecret(ctx context.Context, token, realm, idOfClient string) (*CredentialRepresentation, error)
	// GetKeyStoreConfig gets the keyStoreConfig
	GetKeyStoreConfig(ctx context.Context, accessToken, realm string) (*KeyStoreConfig, error)
	// GetComponents gets components of the given realm
	GetComponents(ctx context.Context, accessToken, realm string) ([]*Component, error)
	// GetDefaultGroups returns a list of default groups
	GetDefaultGroups(ctx context.Context, accessToken, realm string) ([]*Group, error)
	// AddDefaultGroup adds group to the list of default groups
	AddDefaultGroup(ctx context.Context, accessToken, realm, groupID string) error
	// RemoveDefaultGroup removes group from the list of default groups
	RemoveDefaultGroup(ctx context.Context, accessToken, realm, groupID string) error
	// GetGroups gets all groups of the given realm
	GetGroups(ctx context.Context, accessToken, realm string, params GetGroupsParams) ([]*Group, error)
	// GetGroupsByRole gets groups with specified roles assigned of given realm
	GetGroupsByRole(ctx context.Context, accessToken, realm string, roleName string) ([]*Group, error)
	// GetGroupsCount gets groups count of the given realm
	GetGroupsCount(ctx context.Context, token, realm string, params GetGroupsParams) (int, error)
	// GetGroup gets the given group
	GetGroup(ctx context.Context, accessToken, realm, groupID string) (*Group, error)
	// GetGroupMembers get a list of users of group with id in realm
	GetGroupMembers(ctx context.Context, accessToken, realm, groupID string, params GetGroupsParams) ([]*User, error)
	// GetRoleMappingByGroupID gets the rolemapping for the given group id
	GetRoleMappingByGroupID(ctx context.Context, accessToken, realm, groupID string) (*MappingsRepresentation, error)
	// GetRoleMappingByUserID gets the rolemapping for the given user id
	GetRoleMappingByUserID(ctx context.Context, accessToken, realm, userID string) (*MappingsRepresentation, error)
	// GetClients gets the clients in the realm
	GetClients(ctx context.Context, accessToken, realm string, params GetClientsParams) ([]*Client, error)
	// GetClientOfflineSessions returns offline sessions associated with the client
	GetClientOfflineSessions(ctx context.Context, token, realm, idOfClient string) ([]*UserSessionRepresentation, error)
	// GetClientUserSessions returns user sessions associated with the client
	GetClientUserSessions(ctx context.Context, token, realm, idOfClient string) ([]*UserSessionRepresentation, error)
	// CreateClientProtocolMapper creates a protocol mapper in client scope
	CreateClientProtocolMapper(ctx context.Context, token, realm, idOfClient string, mapper ProtocolMapperRepresentation) (string, error)
	// CreateClientProtocolMapper updates a protocol mapper in client scope
	UpdateClientProtocolMapper(ctx context.Context, token, realm, idOfClient, mapperID string, mapper ProtocolMapperRepresentation) error
	// DeleteClientProtocolMapper deletes a protocol mapper in client scope
	DeleteClientProtocolMapper(ctx context.Context, token, realm, idOfClient, mapperID string) error
	// GetClientRepresentation return a client representation
	GetClientRepresentation(ctx context.Context, accessToken, realm, clientID string) (*Client, error)
	// GetAdapterConfiguration returns a adapter configuration
	GetAdapterConfiguration(ctx context.Context, accessToken, realm, clientID string) (*AdapterConfiguration, error)

	// CreateRealmRole creates a role in a realm
	CreateRealmRole(ctx context.Context, token, realm string, role Role) (string, error)
	// GetRealmRole returns a role from a realm by role's name
	GetRealmRole(ctx context.Context, token, realm, roleName string) (*Role, error)
	// GetRealmRoleByID returns a role from a realm by role's ID
	GetRealmRoleByID(ctx context.Context, token, realm, roleID string) (*Role, error)
	// GetRealmRoles get all roles of the given realm. It's an alias for the GetRoles function
	GetRealmRoles(ctx context.Context, accessToken, realm string, params GetRoleParams) ([]*Role, error)
	// GetRealmRolesByUserID returns all roles assigned to the given user
	GetRealmRolesByUserID(ctx context.Context, accessToken, realm, userID string) ([]*Role, error)
	// GetRealmRolesByGroupID returns all roles assigned to the given group
	GetRealmRolesByGroupID(ctx context.Context, accessToken, realm, groupID string) ([]*Role, error)
	// UpdateRealmRole updates a role in a realm
	UpdateRealmRole(ctx context.Context, token, realm, roleName string, role Role) error
	// UpdateRealmRoleByID updates a role in a realm by role's ID
	UpdateRealmRoleByID(ctx context.Context, token, realm, roleID string, role Role) error
	// DeleteRealmRole deletes a role in a realm by role's name
	DeleteRealmRole(ctx context.Context, token, realm, roleName string) error
	// AddRealmRoleToUser adds realm-level role mappings
	AddRealmRoleToUser(ctx context.Context, token, realm, userID string, roles []Role) error
	// DeleteRealmRoleFromUser deletes realm-level role mappings
	DeleteRealmRoleFromUser(ctx context.Context, token, realm, userID string, roles []Role) error
	// AddRealmRoleToGroup adds realm-level role mappings
	AddRealmRoleToGroup(ctx context.Context, token, realm, groupID string, roles []Role) error
	// DeleteRealmRoleFromGroup deletes realm-level role mappings
	DeleteRealmRoleFromGroup(ctx context.Context, token, realm, groupID string, roles []Role) error
	// AddRealmRoleComposite adds roles as composite
	AddRealmRoleComposite(ctx context.Context, token, realm, roleName string, roles []Role) error
	// AddRealmRoleComposite adds roles as composite
	DeleteRealmRoleComposite(ctx context.Context, token, realm, roleName string, roles []Role) error
	// GetCompositeRealmRoles returns all realm composite roles associated with the given realm role
	GetCompositeRealmRoles(ctx context.Context, token, realm, roleName string) ([]*Role, error)
	// GetCompositeRealmRolesByRoleID returns all realm composite roles associated with the given client role
	GetCompositeRealmRolesByRoleID(ctx context.Context, token, realm, roleID string) ([]*Role, error)
	// GetCompositeRealmRolesByUserID returns all realm roles and composite roles assigned to the given user
	GetCompositeRealmRolesByUserID(ctx context.Context, token, realm, userID string) ([]*Role, error)
	// GetCompositeRealmRolesByGroupID returns all realm roles and composite roles assigned to the given group
	GetCompositeRealmRolesByGroupID(ctx context.Context, token, realm, groupID string) ([]*Role, error)
	// GetAvailableRealmRolesByUserID returns all available realm roles to the given user
	GetAvailableRealmRolesByUserID(ctx context.Context, token, realm, userID string) ([]*Role, error)
	// GetAvailableRealmRolesByGroupID returns all available realm roles to the given group
	GetAvailableRealmRolesByGroupID(ctx context.Context, token, realm, groupID string) ([]*Role, error)

	// AddClientRoleToUser adds a client role to the user
	AddClientRoleToUser(ctx context.Context, token, realm, idOfClient, userID string, roles []Role) error
	// AddClientRoleToGroup adds a client role to the group
	AddClientRoleToGroup(ctx context.Context, token, realm, idOfClient, groupID string, roles []Role) error
	// CreateClientRole creates a new role for a client
	CreateClientRole(ctx context.Context, accessToken, realm, idOfClient string, role Role) (string, error)
	// DeleteClientRole deletes the given role
	DeleteClientRole(ctx context.Context, accessToken, realm, idOfClient, roleName string) error
	// DeleteClientRoleFromUser removes a client role from from the user
	DeleteClientRoleFromUser(ctx context.Context, token, realm, idOfClient, userID string, roles []Role) error
	// DeleteClientRoleFromGroup removes a client role from from the group
	DeleteClientRoleFromGroup(ctx context.Context, token, realm, idOfClient, groupID string, roles []Role) error
	// GetClientRoles gets roles for the given client
	GetClientRoles(ctx context.Context, accessToken, realm, idOfClient string, params GetRoleParams) ([]*Role, error)
	// GetClientRoleById gets role for the given client using role id
	GetClientRoleByID(ctx context.Context, accessToken, realm, roleID string) (*Role, error)
	// GetRealmRolesByUserID returns all client roles assigned to the given user
	GetClientRolesByUserID(ctx context.Context, token, realm, idOfClient, userID string) ([]*Role, error)
	// GetClientRolesByGroupID returns all client roles assigned to the given group
	GetClientRolesByGroupID(ctx context.Context, token, realm, idOfClient, groupID string) ([]*Role, error)
	// GetCompositeClientRolesByRoleID returns all client composite roles associated with the given client role
	GetCompositeClientRolesByRoleID(ctx context.Context, token, realm, idOfClient, roleID string) ([]*Role, error)
	// GetCompositeClientRolesByUserID returns all client roles and composite roles assigned to the given user
	GetCompositeClientRolesByUserID(ctx context.Context, token, realm, idOfClient, userID string) ([]*Role, error)
	// GetCompositeClientRolesByGroupID returns all client roles and composite roles assigned to the given group
	GetCompositeClientRolesByGroupID(ctx context.Context, token, realm, idOfClient, groupID string) ([]*Role, error)
	// GetAvailableClientRolesByUserID returns all available client roles to the given user
	GetAvailableClientRolesByUserID(ctx context.Context, token, realm, idOfClient, userID string) ([]*Role, error)
	// GetAvailableClientRolesByGroupID returns all available client roles to the given group
	GetAvailableClientRolesByGroupID(ctx context.Context, token, realm, idOfClient, groupID string) ([]*Role, error)

	// GetClientRole get a role for the given client in a realm by role name
	GetClientRole(ctx context.Context, token, realm, idOfClient, roleName string) (*Role, error)
	// AddClientRoleComposite adds roles as composite
	AddClientRoleComposite(ctx context.Context, token, realm, roleID string, roles []Role) error
	// DeleteClientRoleComposite deletes composites from a role
	DeleteClientRoleComposite(ctx context.Context, token, realm, roleID string, roles []Role) error

	// GetRealm returns top-level representation of the realm
	GetRealm(ctx context.Context, token, realm string) (*RealmRepresentation, error)
	// GetRealms returns top-level representation of all realms
	GetRealms(ctx context.Context, token string) ([]*RealmRepresentation, error)
	// CreateRealm creates a realm
	CreateRealm(ctx context.Context, token string, realm RealmRepresentation) (string, error)
	// UpdateRealm updates a given realm
	UpdateRealm(ctx context.Context, token string, realm RealmRepresentation) error
	// DeleteRealm removes a realm
	DeleteRealm(ctx context.Context, token, realm string) error
	// ClearRealmCache clears realm cache
	ClearRealmCache(ctx context.Context, token, realm string) error
	// ClearUserCache clears realm cache
	ClearUserCache(ctx context.Context, token, realm string) error
	// ClearKeysCache clears realm cache
	ClearKeysCache(ctx context.Context, token, realm string) error
	//GetAuthenticationFlows get all authentication flows from a realm
	GetAuthenticationFlows(ctx context.Context, token, realm string) ([]*AuthenticationFlowRepresentation, error)
	//Create a new Authentication flow in a realm
	CreateAuthenticationFlow(ctx context.Context, token, realm string, flow AuthenticationFlowRepresentation) error
	//DeleteAuthenticationFlow deletes a flow in a realm with the given ID
	DeleteAuthenticationFlow(ctx context.Context, token, realm, flowID string) error
	//GetAuthenticationExecutions retrieves all executions of a given flow
	GetAuthenticationExecutions(ctx context.Context, token, realm, flow string) ([]*ModifyAuthenticationExecutionRepresentation, error)
	//CreateAuthenticationExecution creates a new execution for the given flow name in the given realm
	CreateAuthenticationExecution(ctx context.Context, token, realm, flow string, execution CreateAuthenticationExecutionRepresentation) error
	//UpdateAuthenticationExecution updates an authentication execution for the given flow in the given realm
	UpdateAuthenticationExecution(ctx context.Context, token, realm, flow string, execution ModifyAuthenticationExecutionRepresentation) error
	// DeleteAuthenticationExecution delete a single execution with the given ID
	DeleteAuthenticationExecution(ctx context.Context, token, realm, executionID string) error

	// *** Users ***
	// CreateUser creates a new user
	CreateUser(ctx context.Context, token, realm string, user User) (string, error)
	// DeleteUser deletes the given user
	DeleteUser(ctx context.Context, accessToken, realm, userID string) error
	// GetUserByID gets the user with the given id
	GetUserByID(ctx context.Context, accessToken, realm, userID string) (*User, error)
	// GetUser count returns the userCount of the given realm
	GetUserCount(ctx context.Context, accessToken, realm string, params GetUsersParams) (int, error)
	// GetUsers gets all users of the given realm
	GetUsers(ctx context.Context, accessToken, realm string, params GetUsersParams) ([]*User, error)
	// GetUserGroups gets the groups of the given user
	GetUserGroups(ctx context.Context, accessToken, realm, userID string, params GetGroupsParams) ([]*Group, error)
	// GetUsersByRoleName returns all users have a given role
	GetUsersByRoleName(ctx context.Context, token, realm, roleName string) ([]*User, error)
	// GetUsersByClientRoleName returns all users have a given client role
	GetUsersByClientRoleName(ctx context.Context, token, realm, idOfClient, roleName string, params GetUsersByRoleParams) ([]*User, error)
	// SetPassword sets a new password for the user with the given id. Needs elevated privileges
	SetPassword(ctx context.Context, token, userID, realm, password string, temporary bool) error
	// UpdateUser updates the given user
	UpdateUser(ctx context.Context, accessToken, realm string, user User) error
	// AddUserToGroup puts given user to given group
	AddUserToGroup(ctx context.Context, token, realm, userID, groupID string) error
	// DeleteUserFromGroup deletes given user from given group
	DeleteUserFromGroup(ctx context.Context, token, realm, userID, groupID string) error
	// GetUserSessions returns user sessions associated with the user
	GetUserSessions(ctx context.Context, token, realm, userID string) ([]*UserSessionRepresentation, error)
	// GetUserOfflineSessionsForClient returns offline sessions associated with the user and client
	GetUserOfflineSessionsForClient(ctx context.Context, token, realm, userID, idOfClient string) ([]*UserSessionRepresentation, error)
	// GetUserFederatedIdentities gets all user federated identities
	GetUserFederatedIdentities(ctx context.Context, token, realm, userID string) ([]*FederatedIdentityRepresentation, error)
	// CreateUserFederatedIdentity creates an user federated identity
	CreateUserFederatedIdentity(ctx context.Context, token, realm, userID, providerID string, federatedIdentityRep FederatedIdentityRepresentation) error
	// DeleteUserFederatedIdentity deletes an user federated identity
	DeleteUserFederatedIdentity(ctx context.Context, token, realm, userID, providerID string) error

	// *** Identity Provider **
	// CreateIdentityProvider creates an identity provider in a realm
	CreateIdentityProvider(ctx context.Context, token, realm string, providerRep IdentityProviderRepresentation) (string, error)
	// GetIdentityProviders gets identity providers in a realm
	GetIdentityProviders(ctx context.Context, token, realm string) ([]*IdentityProviderRepresentation, error)
	// GetIdentityProvider gets the identity provider in a realm
	GetIdentityProvider(ctx context.Context, token, realm, alias string) (*IdentityProviderRepresentation, error)
	// UpdateIdentityProvider updates the identity provider in a realm
	UpdateIdentityProvider(ctx context.Context, token, realm, alias string, providerRep IdentityProviderRepresentation) error
	// DeleteIdentityProvider deletes the identity provider in a realm
	DeleteIdentityProvider(ctx context.Context, token, realm, alias string) error
	// ImportIdentityProviderConfig parses and returns the identity provider config at a given URL
	ImportIdentityProviderConfig(ctx context.Context, token, realm, fromURL, providerID string) (map[string]string, error)
	// ImportIdentityProviderConfigFromFile parses and returns the identity provider config from a given file
	ImportIdentityProviderConfigFromFile(ctx context.Context, token, realm, providerID, fileName string, fileBody io.Reader) (map[string]string, error)
	// ExportIDPPublicBrokerConfig exports the broker config for a given alias
	ExportIDPPublicBrokerConfig(ctx context.Context, token, realm, alias string) (*string, error)
	// CreateIdentityProviderMapper creates an instance of an identity provider mapper associated with the given alias
	CreateIdentityProviderMapper(ctx context.Context, token, realm, alias string, mapper IdentityProviderMapper) (string, error)
	// GetIdentityProviderMapperByID gets the mapper of an identity provider
	GetIdentityProviderMapperByID(ctx context.Context, token, realm, alias, mapperID string) (*IdentityProviderMapper, error)
	// UpdateIdentityProviderMapper updates mapper of an identity provider
	UpdateIdentityProviderMapper(ctx context.Context, token, realm, alias string, mapper IdentityProviderMapper) error
	// DeleteIdentityProviderMapper deletes an instance of an identity provider mapper associated with the given alias and mapper ID
	DeleteIdentityProviderMapper(ctx context.Context, token, realm, alias, mapperID string) error
	// GetIdentityProviderMappers returns list of mappers associated with an identity provider
	GetIdentityProviderMappers(ctx context.Context, token, realm, alias string) ([]*IdentityProviderMapper, error)

	// *** Protection API ***
	// GetResource returns a client's resource with the given id, using access token from client
	GetResourceClient(ctx context.Context, token, realm, resourceID string) (*ResourceRepresentation, error)
	// GetResources a returns resources associated with the client, using access token from client
	GetResourcesClient(ctx context.Context, token, realm string, params GetResourceParams) ([]*ResourceRepresentation, error)
	// CreateResource creates a resource associated with the client, using access token from client
	CreateResourceClient(ctx context.Context, token, realm string, resource ResourceRepresentation) (*ResourceRepresentation, error)
	// UpdateResource updates a resource associated with the client, using access token from client
	UpdateResourceClient(ctx context.Context, token, realm string, resource ResourceRepresentation) error
	// DeleteResource deletes a resource associated with the client, using access token from client
	DeleteResourceClient(ctx context.Context, token, realm, resourceID string) error

	// GetResource returns a client's resource with the given id, using access token from admin
	GetResource(ctx context.Context, token, realm, idOfClient, resourceID string) (*ResourceRepresentation, error)
	// GetResources a returns resources associated with the client, using access token from admin
	GetResources(ctx context.Context, token, realm, idOfClient string, params GetResourceParams) ([]*ResourceRepresentation, error)
	// CreateResource creates a resource associated with the client, using access token from admin
	CreateResource(ctx context.Context, token, realm, idOfClient string, resource ResourceRepresentation) (*ResourceRepresentation, error)
	// UpdateResource updates a resource associated with the client, using access token from admin
	UpdateResource(ctx context.Context, token, realm, idOfClient string, resource ResourceRepresentation) error
	// DeleteResource deletes a resource associated with the client, using access token from admin
	DeleteResource(ctx context.Context, token, realm, idOfClient, resourceID string) error

	// GetScope returns a client's scope with the given id, using access token from admin
	GetScope(ctx context.Context, token, realm, idOfClient, scopeID string) (*ScopeRepresentation, error)
	// GetScopes returns scopes associated with the client, using access token from admin
	GetScopes(ctx context.Context, token, realm, idOfClient string, params GetScopeParams) ([]*ScopeRepresentation, error)
	// CreateScope creates a scope associated with the client, using access token from admin
	CreateScope(ctx context.Context, token, realm, idOfClient string, scope ScopeRepresentation) (*ScopeRepresentation, error)
	// UpdateScope updates a scope associated with the client, using access token from admin
	UpdateScope(ctx context.Context, token, realm, idOfClient string, resource ScopeRepresentation) error
	// DeleteScope deletes a scope associated with the client, using access token from admin
	DeleteScope(ctx context.Context, token, realm, idOfClient, scopeID string) error

	// CreatePermissionTicket creates a permission ticket for a resource, using access token from client (typically a resource server)
	CreatePermissionTicket(ctx context.Context, token, realm string, permissions []CreatePermissionTicketParams) (*PermissionTicketResponseRepresentation, error)
	// GrantUserPermission lets resource owner grant permission for specific resource ID to specific user ID
	GrantUserPermission(ctx context.Context, token, realm string, permission PermissionGrantParams) (*PermissionGrantResponseRepresentation, error)
	// GrantPermission lets resource owner update permission for specific resource ID to specific user ID
	UpdateUserPermission(ctx context.Context, token, realm string, permission PermissionGrantParams) (*PermissionGrantResponseRepresentation, error)
	// GetUserPermission gets granted permissions according query parameters
	GetUserPermissions(ctx context.Context, token, realm string, params GetUserPermissionParams) ([]*PermissionGrantResponseRepresentation, error)
	// DeleteUserPermission lets resource owner delete permission for specific resource ID to specific user ID
	DeleteUserPermission(ctx context.Context, token, realm, ticketID string) error

	// GetPermission returns a client's permission with the given id
	GetPermission(ctx context.Context, token, realm, idOfClient, permissionID string) (*PermissionRepresentation, error)
	// GetPermissions returns permissions associated with the client
	GetPermissions(ctx context.Context, token, realm, idOfClient string, params GetPermissionParams) ([]*PermissionRepresentation, error)
	// CreatePermission creates a permission associated with the client
	CreatePermission(ctx context.Context, token, realm, idOfClient string, permission PermissionRepresentation) (*PermissionRepresentation, error)
	// UpdatePermission updates a permission associated with the client
	UpdatePermission(ctx context.Context, token, realm, idOfClient string, permission PermissionRepresentation) error
	// DeletePermission deletes a permission associated with the client
	DeletePermission(ctx context.Context, token, realm, idOfClient, permissionID string) error
	// GetDependentPermissions returns client's permissions dependent on the policy with given ID
	GetDependentPermissions(ctx context.Context, token, realm, idOfClient, policyID string) ([]*PermissionRepresentation, error)
	GetPermissionResources(ctx context.Context, token, realm, idOfClient, permissionID string) ([]*PermissionResource, error)
	GetPermissionScopes(ctx context.Context, token, realm, idOfClient, permissionID string) ([]*PermissionScope, error)

	// GetPolicy returns a client's policy with the given id, using access token from admin
	GetPolicy(ctx context.Context, token, realm, idOfClient, policyID string) (*PolicyRepresentation, error)
	// GetPolicies returns policies associated with the client, using access token from admin
	GetPolicies(ctx context.Context, token, realm, idOfClient string, params GetPolicyParams) ([]*PolicyRepresentation, error)
	// CreatePolicy creates a policy associated with the client, using access token from admin
	CreatePolicy(ctx context.Context, token, realm, idOfClient string, policy PolicyRepresentation) (*PolicyRepresentation, error)
	// UpdatePolicy updates a policy associated with the client, using access token from admin
	UpdatePolicy(ctx context.Context, token, realm, idOfClient string, policy PolicyRepresentation) error
	// DeletePolicy deletes a policy associated with the client, using access token from admin
	DeletePolicy(ctx context.Context, token, realm, idOfClient, policyID string) error
	// GetPolicyAssociatedPolicies returns a client's policy associated policies with the given policy id, using access token from admin
	GetAuthorizationPolicyAssociatedPolicies(ctx context.Context, token, realm, idOfClient, policyID string) ([]*PolicyRepresentation, error)
	// GetPolicyResources returns a client's resources of specific policy with the given policy id, using access token from admin
	GetAuthorizationPolicyResources(ctx context.Context, token, realm, idOfClient, policyID string) ([]*PolicyResourceRepresentation, error)
	// GetPolicyScopes returns a client's scopes of specific policy with the given policy id, using access token from admin
	GetAuthorizationPolicyScopes(ctx context.Context, token, realm, idOfClient, policyID string) ([]*PolicyScopeRepresentation, error)

	// GetResourcePolicy updates a permission for a specifc resource, using token obtained by Resource Owner Password Credentials Grant or Token exchange
	GetResourcePolicy(ctx context.Context, token, realm, permissionID string) (*ResourcePolicyRepresentation, error)
	// GetResources returns resources associated with the client, using token obtained by Resource Owner Password Credentials Grant or Token exchange
	GetResourcePolicies(ctx context.Context, token, realm string, params GetResourcePoliciesParams) ([]*ResourcePolicyRepresentation, error)
	// GetResources returns all resources associated with the client, using token obtained by Resource Owner Password Credentials Grant or Token exchange
	CreateResourcePolicy(ctx context.Context, token, realm, resourceID string, policy ResourcePolicyRepresentation) (*ResourcePolicyRepresentation, error)
	// UpdateResourcePolicy updates a permission for a specifc resource, using token obtained by Resource Owner Password Credentials Grant or Token exchange
	UpdateResourcePolicy(ctx context.Context, token, realm, permissionID string, policy ResourcePolicyRepresentation) error
	// DeleteResourcePolicy deletes a permission for a specifc resource, using token obtained by Resource Owner Password Credentials Grant or Token exchange
	DeleteResourcePolicy(ctx context.Context, token, realm, permissionID string) error

	// GetCredentialRegistrators returns credentials registrators
	GetCredentialRegistrators(ctx context.Context, token, realm string) ([]string, error)
	// GetConfiguredUserStorageCredentialTypes returns credential types, which are provided by the user storage where user is stored
	GetConfiguredUserStorageCredentialTypes(ctx context.Context, token, realm, userID string) ([]string, error)

	// GetCredentials returns credentials available for a given user
	GetCredentials(ctx context.Context, token, realm, UserID string) ([]*CredentialRepresentation, error)
	// DeleteCredentials deletes the given credential for a given user
	DeleteCredentials(ctx context.Context, token, realm, UserID, CredentialID string) error
	// UpdateCredentialUserLabel updates label for the given credential for the given user
	UpdateCredentialUserLabel(ctx context.Context, token, realm, userID, credentialID, userLabel string) error
	// DisableAllCredentialsByType disables all credentials for a user of a specific type
	DisableAllCredentialsByType(ctx context.Context, token, realm, userID string, types []string) error
	// MoveCredentialBehind move a credential to a position behind another credential
	MoveCredentialBehind(ctx context.Context, token, realm, userID, credentialID, newPreviousCredentialID string) error
	// MoveCredentialToFirst move a credential to a first position in the credentials list of the user
	MoveCredentialToFirst(ctx context.Context, token, realm, userID, credentialID string) error

	// ---------------
	// Events API
	// ---------------
	// GetEvents returns events
	GetEvents(ctx context.Context, token string, realm string, params GetEventsParams) ([]*EventRepresentation, error)
}

GoCloak holds all methods a client should fulfill

func NewClient

func NewClient(basePath string, options ...func(*gocloak)) GoCloak

NewClient creates a new Client

type Group

type Group struct {
	ID          *string              `json:"id,omitempty"`
	Name        *string              `json:"name,omitempty"`
	Path        *string              `json:"path,omitempty"`
	SubGroups   *[]Group             `json:"subGroups,omitempty"`
	Attributes  *map[string][]string `json:"attributes,omitempty"`
	Access      *map[string]bool     `json:"access,omitempty"`
	ClientRoles *map[string][]string `json:"clientRoles,omitempty"`
	RealmRoles  *[]string            `json:"realmRoles,omitempty"`
}

Group is a Group

func (*Group) String

func (v *Group) String() string

type GroupDefinition

type GroupDefinition struct {
	ID             *string `json:"id,omitempty"`
	Path           *string `json:"path,omitempty"`
	ExtendChildren *bool   `json:"extendChildren,omitempty"`
}

GroupDefinition represents a group in a GroupPolicyRepresentation

func (*GroupDefinition) String

func (v *GroupDefinition) String() string

type GroupPolicyRepresentation

type GroupPolicyRepresentation struct {
	Groups      *[]GroupDefinition `json:"groups,omitempty"`
	GroupsClaim *string            `json:"groupsClaim,omitempty"`
}

GroupPolicyRepresentation represents group based policies

func (*GroupPolicyRepresentation) String

func (v *GroupPolicyRepresentation) String() string

type GroupsCount

type GroupsCount struct {
	Count int `json:"count,omitempty"`
}

GroupsCount represents the groups count response from keycloak

func (*GroupsCount) String

func (v *GroupsCount) String() string

type HTTPErrorResponse

type HTTPErrorResponse struct {
	Error       string `json:"error,omitempty"`
	Message     string `json:"errorMessage,omitempty"`
	Description string `json:"error_description,omitempty"`
}

HTTPErrorResponse is a model of an error response

func (HTTPErrorResponse) NotEmpty

func (e HTTPErrorResponse) NotEmpty() bool

NotEmpty validates that error is not emptyp

func (HTTPErrorResponse) String

func (e HTTPErrorResponse) String() string

String returns a string representation of an error

type IdentityProviderMapper

type IdentityProviderMapper struct {
	ID                     *string            `json:"id,omitempty"`
	Name                   *string            `json:"name,omitempty"`
	IdentityProviderMapper *string            `json:"identityProviderMapper,omitempty"`
	IdentityProviderAlias  *string            `json:"identityProviderAlias,omitempty"`
	Config                 *map[string]string `json:"config"`
}

IdentityProviderMapper represents the body of a call to add a mapper to an identity provider

type IdentityProviderRepresentation

type IdentityProviderRepresentation struct {
	AddReadTokenRoleOnCreate  *bool              `json:"addReadTokenRoleOnCreate,omitempty"`
	Alias                     *string            `json:"alias,omitempty"`
	Config                    *map[string]string `json:"config,omitempty"`
	DisplayName               *string            `json:"displayName,omitempty"`
	Enabled                   *bool              `json:"enabled,omitempty"`
	FirstBrokerLoginFlowAlias *string            `json:"firstBrokerLoginFlowAlias,omitempty"`
	InternalID                *string            `json:"internalId,omitempty"`
	LinkOnly                  *bool              `json:"linkOnly,omitempty"`
	PostBrokerLoginFlowAlias  *string            `json:"postBrokerLoginFlowAlias,omitempty"`
	ProviderID                *string            `json:"providerId,omitempty"`
	StoreToken                *bool              `json:"storeToken,omitempty"`
	TrustEmail                *bool              `json:"trustEmail,omitempty"`
}

IdentityProviderRepresentation represents an identity provider

func (*IdentityProviderRepresentation) String

type IssuerResponse

type IssuerResponse struct {
	Realm           *string `json:"realm,omitempty"`
	PublicKey       *string `json:"public_key,omitempty"`
	TokenService    *string `json:"token-service,omitempty"`
	AccountService  *string `json:"account-service,omitempty"`
	TokensNotBefore *int    `json:"tokens-not-before,omitempty"`
}

IssuerResponse is returned by the issuer endpoint

func (*IssuerResponse) String

func (v *IssuerResponse) String() string

type JSPolicyRepresentation

type JSPolicyRepresentation struct {
	Code *string `json:"code,omitempty"`
}

JSPolicyRepresentation represents js based policies

func (*JSPolicyRepresentation) String

func (v *JSPolicyRepresentation) String() string

type JWT

type JWT struct {
	AccessToken      string `json:"access_token"`
	IDToken          string `json:"id_token"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	NotBeforePolicy  int    `json:"not-before-policy"`
	SessionState     string `json:"session_state"`
	Scope            string `json:"scope"`
}

JWT is a JWT

type Key

type Key struct {
	ProviderID       *string `json:"providerId,omitempty"`
	ProviderPriority *int    `json:"providerPriority,omitempty"`
	Kid              *string `json:"kid,omitempty"`
	Status           *string `json:"status,omitempty"`
	Type             *string `json:"type,omitempty"`
	Algorithm        *string `json:"algorithm,omitempty"`
	PublicKey        *string `json:"publicKey,omitempty"`
	Certificate      *string `json:"certificate,omitempty"`
}

Key is a key

func (*Key) String

func (v *Key) String() string

type KeyStoreConfig

type KeyStoreConfig struct {
	ActiveKeys *ActiveKeys `json:"active,omitempty"`
	Key        *[]Key      `json:"keys,omitempty"`
}

KeyStoreConfig holds the keyStoreConfig

func (*KeyStoreConfig) String

func (v *KeyStoreConfig) String() string

type Logic

type Logic string

Logic is an enum type for policy logic

func LogicP

func LogicP(value Logic) *Logic

LogicP returns a pointer for a Logic value

type MappingsRepresentation

type MappingsRepresentation struct {
	ClientMappings map[string]*ClientMappingsRepresentation `json:"clientMappings,omitempty"`
	RealmMappings  *[]Role                                  `json:"realmMappings,omitempty"`
}

MappingsRepresentation is a representation of role mappings

func (*MappingsRepresentation) String

func (v *MappingsRepresentation) String() string

type MemoryInfoRepresentation

type MemoryInfoRepresentation struct {
	Free           *int    `json:"free,omitempty"`
	FreeFormated   *string `json:"freeFormated,omitempty"`
	FreePercentage *int    `json:"freePercentage,omitempty"`
	Total          *int    `json:"total,omitempty"`
	TotalFormated  *string `json:"totalFormated,omitempty"`
	Used           *int    `json:"used,omitempty"`
	UsedFormated   *string `json:"usedFormated,omitempty"`
}

MemoryInfoRepresentation represents a memory info

func (*MemoryInfoRepresentation) String

func (v *MemoryInfoRepresentation) String() string

type ModifyAuthenticationExecutionRepresentation

type ModifyAuthenticationExecutionRepresentation struct {
	ID                  *string `json:"id,omitempty"`
	Provider            *string `json:"providerId,omitempty"`
	AuthenticatorConfig *string `json:"authenticatorConfig,omitempty"`
	AuthenticatorFlow   *bool   `json:"authenticatorFlow,omitempty"`
	AutheticatorFlow    *bool   `json:"autheticatorFlow,omitempty"`
	FlowAlias           *string `json:"flowAlias,omitempty"`
	Priority            *int    `json:"priority,omitempty"`
	Requirement         *string `json:"requirement,omitempty"`
	UserSetupAllowed    *bool   `json:"userSetupAllowed,omitempty"`
}

ModifyAuthenticationExecutionRepresentation is the payload for updating an execution representation

type MultiValuedHashMap

type MultiValuedHashMap struct {
	Empty      *bool    `json:"empty,omitempty"`
	LoadFactor *float32 `json:"loadFactor,omitempty"`
	Threshold  *int32   `json:"threshold,omitempty"`
}

MultiValuedHashMap represents something

func (*MultiValuedHashMap) String

func (v *MultiValuedHashMap) String() string

type PasswordPolicy

type PasswordPolicy struct {
	ConfigType        string `json:"configType,omitempty"`
	DefaultValue      string `json:"defaultValue,omitempty"`
	DisplayName       string `json:"displayName,omitempty"`
	ID                string `json:"id,omitempty"`
	MultipleSupported bool   `json:"multipleSupported,omitempty"`
}

PasswordPolicy represents the configuration for a supported password policy

type PermissionGrantParams

type PermissionGrantParams struct {
	ResourceID  *string `json:"resource,omitempty"`
	RequesterID *string `json:"requester,omitempty"`
	Granted     *bool   `json:"granted,omitempty"`
	ScopeName   *string `json:"scopeName,omitempty"`
	TicketID    *string `json:"id,omitempty"`
}

PermissionGrantParams represents the permission which the resource owner is granting to a specific user

func (*PermissionGrantParams) String

func (v *PermissionGrantParams) String() string

type PermissionGrantResponseRepresentation

type PermissionGrantResponseRepresentation struct {
	ID          *string `json:"id,omitempty"`
	Owner       *string `json:"owner,omitempty"`
	ResourceID  *string `json:"resource,omitempty"`
	Scope       *string `json:"scope,omitempty"`
	Granted     *bool   `json:"granted,omitempty"`
	RequesterID *string `json:"requester,omitempty"`
}

PermissionGrantResponseRepresentation represents the reply from Keycloack after granting permission

func (*PermissionGrantResponseRepresentation) String

type PermissionRepresentation

type PermissionRepresentation struct {
	DecisionStrategy *DecisionStrategy `json:"decisionStrategy,omitempty"`
	Description      *string           `json:"description,omitempty"`
	ID               *string           `json:"id,omitempty"`
	Logic            *Logic            `json:"logic,omitempty"`
	Name             *string           `json:"name,omitempty"`
	Policies         *[]string         `json:"policies,omitempty"`
	Resources        *[]string         `json:"resources,omitempty"`
	ResourceType     *string           `json:"resourceType,omitempty"`
	Scopes           *[]string         `json:"scopes,omitempty"`
	Type             *string           `json:"type,omitempty"`
}

PermissionRepresentation is a representation of a RequestingPartyPermission

func (*PermissionRepresentation) String

func (v *PermissionRepresentation) String() string

type PermissionResource

type PermissionResource struct {
	ResourceID   *string `json:"_id,omitempty"`
	ResourceName *string `json:"name,omitempty"`
}

PermissionResource represents a resources asscoiated with a permission

func (*PermissionResource) String

func (v *PermissionResource) String() string

type PermissionScope

type PermissionScope struct {
	ScopeID   *string `json:"id,omitempty"`
	ScopeName *string `json:"name,omitempty"`
}

PermissionScope represents scopes associated with a permission

func (*PermissionScope) String

func (v *PermissionScope) String() string

type PermissionTicketDescriptionRepresentation

type PermissionTicketDescriptionRepresentation struct {
	ID                     *string               `json:"id,omitempty"`
	CreatedTimeStamp       *int64                `json:"createdTimestamp,omitempty"`
	UserName               *string               `json:"username,omitempty"`
	Enabled                *bool                 `json:"enabled,omitempty"`
	TOTP                   *bool                 `json:"totp,omitempty"`
	EmailVerified          *bool                 `json:"emailVerified,omitempty"`
	FirstName              *string               `json:"firstName,omitempty"`
	LastName               *string               `json:"lastName,omitempty"`
	Email                  *string               `json:"email,omitempty"`
	DisableCredentialTypes *[]string             `json:"disableCredentialTypes,omitempty"`
	RequiredActions        *[]string             `json:"requiredActions,omitempty"`
	NotBefore              *int64                `json:"notBefore,omitempty"`
	Access                 *AccessRepresentation `json:"access,omitempty"`
}

PermissionTicketDescriptionRepresentation represents the parameters returned along with a permission ticket

func (*PermissionTicketDescriptionRepresentation) String

type PermissionTicketPermissionRepresentation

type PermissionTicketPermissionRepresentation struct {
	Scopes *[]string `json:"scopes,omitempty"`
	RSID   *string   `json:"rsid,omitempty"`
}

PermissionTicketPermissionRepresentation represents the individual permissions in a permission ticket

func (*PermissionTicketPermissionRepresentation) String

type PermissionTicketRepresentation

type PermissionTicketRepresentation struct {
	AZP         *string                                     `json:"azp,omitempty"`
	Claims      *map[string][]string                        `json:"claims,omitempty"`
	Permissions *[]PermissionTicketPermissionRepresentation `json:"permissions,omitempty"`
	jwt.StandardClaims
}

PermissionTicketRepresentation represents the permission ticket contents

func (*PermissionTicketRepresentation) String

type PermissionTicketResponseRepresentation

type PermissionTicketResponseRepresentation struct {
	Ticket *string `json:"ticket,omitempty"`
}

PermissionTicketResponseRepresentation represents the keycloak response containing the permission ticket

func (*PermissionTicketResponseRepresentation) String

type PolicyEnforcementMode

type PolicyEnforcementMode string

PolicyEnforcementMode is an enum type for PolicyEnforcementMode of ResourceServerRepresentation

func PolicyEnforcementModeP

func PolicyEnforcementModeP(value PolicyEnforcementMode) *PolicyEnforcementMode

PolicyEnforcementModeP returns a pointer for a PolicyEnforcementMode value

type PolicyRepresentation

type PolicyRepresentation struct {
	Config           *map[string]string `json:"config,omitempty"`
	DecisionStrategy *DecisionStrategy  `json:"decisionStrategy,omitempty"`
	Description      *string            `json:"description,omitempty"`
	ID               *string            `json:"id,omitempty"`
	Logic            *Logic             `json:"logic,omitempty"`
	Name             *string            `json:"name,omitempty"`
	Owner            *string            `json:"owner,omitempty"`
	Policies         *[]string          `json:"policies,omitempty"`
	Resources        *[]string          `json:"resources,omitempty"`
	Scopes           *[]string          `json:"scopes,omitempty"`
	Type             *string            `json:"type,omitempty"`
	RolePolicyRepresentation
	JSPolicyRepresentation
	ClientPolicyRepresentation
	TimePolicyRepresentation
	UserPolicyRepresentation
	AggregatedPolicyRepresentation
	GroupPolicyRepresentation
}

PolicyRepresentation is a representation of a Policy

func (*PolicyRepresentation) String

func (v *PolicyRepresentation) String() string

type PolicyResourceRepresentation

type PolicyResourceRepresentation struct {
	ID   *string `json:"_id,omitempty"`
	Name *string `json:"name,omitempty"`
}

PolicyResourceRepresentation is a representation of a resource of specific policy

type PolicyScopeRepresentation

type PolicyScopeRepresentation struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

PolicyScopeRepresentation is a representation of a scopes of specific policy

type ProtocolMapperRepresentation

type ProtocolMapperRepresentation struct {
	Config         *map[string]string `json:"config,omitempty"`
	ID             *string            `json:"id,omitempty"`
	Name           *string            `json:"name,omitempty"`
	Protocol       *string            `json:"protocol,omitempty"`
	ProtocolMapper *string            `json:"protocolMapper,omitempty"`
}

ProtocolMapperRepresentation represents....

func (*ProtocolMapperRepresentation) String

type 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"`
}

ProtocolMappers are protocolmappers

func (*ProtocolMappers) String

func (v *ProtocolMappers) String() string

type ProtocolMappersConfig

type ProtocolMappersConfig struct {
	UserinfoTokenClaim                 *string `json:"userinfo.token.claim,omitempty"`
	UserAttribute                      *string `json:"user.attribute,omitempty"`
	IDTokenClaim                       *string `json:"id.token.claim,omitempty"`
	AccessTokenClaim                   *string `json:"access.token.claim,omitempty"`
	ClaimName                          *string `json:"claim.name,omitempty"`
	ClaimValue                         *string `json:"claim.value,omitempty"`
	JSONTypeLabel                      *string `json:"jsonType.label,omitempty"`
	Multivalued                        *string `json:"multivalued,omitempty"`
	UsermodelClientRoleMappingClientID *string `json:"usermodel.clientRoleMapping.clientId,omitempty"`
	IncludedClientAudience             *string `json:"included.client.audience,omitempty"`
}

ProtocolMappersConfig is a config of a protocol mapper

func (*ProtocolMappersConfig) String

func (v *ProtocolMappersConfig) String() string

type RealmRepresentation

type RealmRepresentation struct {
	AccessCodeLifespan                  *int                 `json:"accessCodeLifespan,omitempty"`
	AccessCodeLifespanLogin             *int                 `json:"accessCodeLifespanLogin,omitempty"`
	AccessCodeLifespanUserAction        *int                 `json:"accessCodeLifespanUserAction,omitempty"`
	AccessTokenLifespan                 *int                 `json:"accessTokenLifespan,omitempty"`
	AccessTokenLifespanForImplicitFlow  *int                 `json:"accessTokenLifespanForImplicitFlow,omitempty"`
	AccountTheme                        *string              `json:"accountTheme,omitempty"`
	ActionTokenGeneratedByAdminLifespan *int                 `json:"actionTokenGeneratedByAdminLifespan,omitempty"`
	ActionTokenGeneratedByUserLifespan  *int                 `json:"actionTokenGeneratedByUserLifespan,omitempty"`
	AdminEventsDetailsEnabled           *bool                `json:"adminEventsDetailsEnabled,omitempty"`
	AdminEventsEnabled                  *bool                `json:"adminEventsEnabled,omitempty"`
	AdminTheme                          *string              `json:"adminTheme,omitempty"`
	Attributes                          *map[string]string   `json:"attributes,omitempty"`
	AuthenticationFlows                 *[]interface{}       `json:"authenticationFlows,omitempty"`
	AuthenticatorConfig                 *[]interface{}       `json:"authenticatorConfig,omitempty"`
	BrowserFlow                         *string              `json:"browserFlow,omitempty"`
	BrowserSecurityHeaders              *map[string]string   `json:"browserSecurityHeaders,omitempty"`
	BruteForceProtected                 *bool                `json:"bruteForceProtected,omitempty"`
	ClientAuthenticationFlow            *string              `json:"clientAuthenticationFlow,omitempty"`
	ClientScopeMappings                 *map[string]string   `json:"clientScopeMappings,omitempty"`
	ClientScopes                        *[]ClientScope       `json:"clientScopes,omitempty"`
	Clients                             *[]Client            `json:"clients,omitempty"`
	Components                          interface{}          `json:"components,omitempty"`
	DefaultDefaultClientScopes          *[]string            `json:"defaultDefaultClientScopes,omitempty"`
	DefaultGroups                       *[]string            `json:"defaultGroups,omitempty"`
	DefaultLocale                       *string              `json:"defaultLocale,omitempty"`
	DefaultOptionalClientScopes         *[]string            `json:"defaultOptionalClientScopes,omitempty"`
	DefaultRole                         *Role                `json:"defaultRole,omitempty"`
	DefaultRoles                        *[]string            `json:"defaultRoles,omitempty"`
	DefaultSignatureAlgorithm           *string              `json:"defaultSignatureAlgorithm,omitempty"`
	DirectGrantFlow                     *string              `json:"directGrantFlow,omitempty"`
	DisplayName                         *string              `json:"displayName,omitempty"`
	DisplayNameHTML                     *string              `json:"displayNameHtml,omitempty"`
	DockerAuthenticationFlow            *string              `json:"dockerAuthenticationFlow,omitempty"`
	DuplicateEmailsAllowed              *bool                `json:"duplicateEmailsAllowed,omitempty"`
	EditUsernameAllowed                 *bool                `json:"editUsernameAllowed,omitempty"`
	EmailTheme                          *string              `json:"emailTheme,omitempty"`
	Enabled                             *bool                `json:"enabled,omitempty"`
	EnabledEventTypes                   *[]string            `json:"enabledEventTypes,omitempty"`
	EventsEnabled                       *bool                `json:"eventsEnabled,omitempty"`
	EventsExpiration                    *int64               `json:"eventsExpiration,omitempty"`
	EventsListeners                     *[]string            `json:"eventsListeners,omitempty"`
	FailureFactor                       *int                 `json:"failureFactor,omitempty"`
	FederatedUsers                      *[]interface{}       `json:"federatedUsers,omitempty"`
	Groups                              *[]interface{}       `json:"groups,omitempty"`
	ID                                  *string              `json:"id,omitempty"`
	IdentityProviderMappers             *[]interface{}       `json:"identityProviderMappers,omitempty"`
	IdentityProviders                   *[]interface{}       `json:"identityProviders,omitempty"`
	InternationalizationEnabled         *bool                `json:"internationalizationEnabled,omitempty"`
	KeycloakVersion                     *string              `json:"keycloakVersion,omitempty"`
	LoginTheme                          *string              `json:"loginTheme,omitempty"`
	LoginWithEmailAllowed               *bool                `json:"loginWithEmailAllowed,omitempty"`
	MaxDeltaTimeSeconds                 *int                 `json:"maxDeltaTimeSeconds,omitempty"`
	MaxFailureWaitSeconds               *int                 `json:"maxFailureWaitSeconds,omitempty"`
	MinimumQuickLoginWaitSeconds        *int                 `json:"minimumQuickLoginWaitSeconds,omitempty"`
	NotBefore                           *int                 `json:"notBefore,omitempty"`
	OfflineSessionIdleTimeout           *int                 `json:"offlineSessionIdleTimeout,omitempty"`
	OfflineSessionMaxLifespan           *int                 `json:"offlineSessionMaxLifespan,omitempty"`
	OfflineSessionMaxLifespanEnabled    *bool                `json:"offlineSessionMaxLifespanEnabled,omitempty"`
	OtpPolicyAlgorithm                  *string              `json:"otpPolicyAlgorithm,omitempty"`
	OtpPolicyDigits                     *int                 `json:"otpPolicyDigits,omitempty"`
	OtpPolicyInitialCounter             *int                 `json:"otpPolicyInitialCounter,omitempty"`
	OtpPolicyLookAheadWindow            *int                 `json:"otpPolicyLookAheadWindow,omitempty"`
	OtpPolicyPeriod                     *int                 `json:"otpPolicyPeriod,omitempty"`
	OtpPolicyType                       *string              `json:"otpPolicyType,omitempty"`
	OtpSupportedApplications            *[]string            `json:"otpSupportedApplications,omitempty"`
	PasswordPolicy                      *string              `json:"passwordPolicy,omitempty"`
	PermanentLockout                    *bool                `json:"permanentLockout,omitempty"`
	ProtocolMappers                     *[]interface{}       `json:"protocolMappers,omitempty"`
	QuickLoginCheckMilliSeconds         *int64               `json:"quickLoginCheckMilliSeconds,omitempty"`
	Realm                               *string              `json:"realm,omitempty"`
	RefreshTokenMaxReuse                *int                 `json:"refreshTokenMaxReuse,omitempty"`
	RegistrationAllowed                 *bool                `json:"registrationAllowed,omitempty"`
	RegistrationEmailAsUsername         *bool                `json:"registrationEmailAsUsername,omitempty"`
	RegistrationFlow                    *string              `json:"registrationFlow,omitempty"`
	RememberMe                          *bool                `json:"rememberMe,omitempty"`
	RequiredActions                     *[]interface{}       `json:"requiredActions,omitempty"`
	ResetCredentialsFlow                *string              `json:"resetCredentialsFlow,omitempty"`
	ResetPasswordAllowed                *bool                `json:"resetPasswordAllowed,omitempty"`
	RevokeRefreshToken                  *bool                `json:"revokeRefreshToken,omitempty"`
	Roles                               *RolesRepresentation `json:"roles,omitempty"`
	ScopeMappings                       *[]interface{}       `json:"scopeMappings,omitempty"`
	SMTPServer                          *map[string]string   `json:"smtpServer,omitempty"`
	SslRequired                         *string              `json:"sslRequired,omitempty"`
	SsoSessionIdleTimeout               *int                 `json:"ssoSessionIdleTimeout,omitempty"`
	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"`
}

RealmRepresentation represents a realm

func (*RealmRepresentation) String

func (v *RealmRepresentation) String() string

type RequestingPartyPermission

type RequestingPartyPermission struct {
	Claims       *map[string]string `json:"claims,omitempty"`
	ResourceID   *string            `json:"rsid,omitempty"`
	ResourceName *string            `json:"rsname,omitempty"`
	Scopes       *[]string          `json:"scopes,omitempty"`
}

RequestingPartyPermission is returned by request party token with response type set to "permissions"

func (*RequestingPartyPermission) String

func (v *RequestingPartyPermission) String() string

type RequestingPartyPermissionDecision

type RequestingPartyPermissionDecision struct {
	Result *bool `json:"result,omitempty"`
}

RequestingPartyPermissionDecision is returned by request party token with response type set to "decision"

type RequestingPartyTokenOptions

type RequestingPartyTokenOptions struct {
	GrantType                   *string   `json:"grant_type,omitempty"`
	Ticket                      *string   `json:"ticket,omitempty"`
	ClaimToken                  *string   `json:"claim_token,omitempty"`
	ClaimTokenFormat            *string   `json:"claim_token_format,omitempty"`
	RPT                         *string   `json:"rpt,omitempty"`
	Permissions                 *[]string `json:"-"`
	Audience                    *string   `json:"audience,omitempty"`
	ResponseIncludeResourceName *bool     `json:"response_include_resource_name,string,omitempty"`
	ResponsePermissionsLimit    *uint32   `json:"response_permissions_limit,omitempty"`
	SubmitRequest               *bool     `json:"submit_request,string,omitempty"`
	ResponseMode                *string   `json:"response_mode,omitempty"`
	SubjectToken                *string   `json:"subject_token,omitempty"`
}

RequestingPartyTokenOptions represents the options to obtain a requesting party token

func (*RequestingPartyTokenOptions) FormData

func (t *RequestingPartyTokenOptions) FormData() map[string]string

FormData returns a map of options to be used in SetFormData function

func (*RequestingPartyTokenOptions) String

func (t *RequestingPartyTokenOptions) String() string

type ResourceOwnerRepresentation

type ResourceOwnerRepresentation struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

ResourceOwnerRepresentation represents a resource's owner

func (*ResourceOwnerRepresentation) String

func (v *ResourceOwnerRepresentation) String() string

type ResourcePermission

type ResourcePermission struct {
	RSID           *string   `json:"rsid,omitempty"`
	ResourceID     *string   `json:"resource_id,omitempty"`
	RSName         *string   `json:"rsname,omitempty"`
	Scopes         *[]string `json:"scopes,omitempty"`
	ResourceScopes *[]string `json:"resource_scopes,omitempty"`
}

ResourcePermission represents a permission granted to a resource

func (*ResourcePermission) String

func (v *ResourcePermission) String() string

type ResourcePolicyRepresentation

type ResourcePolicyRepresentation struct {
	Name             *string           `json:"name,omitempty"`
	Description      *string           `json:"description,omitempty"`
	Scopes           *[]string         `json:"scopes,omitempty"`
	Roles            *[]string         `json:"roles,omitempty"`
	Groups           *[]string         `json:"groups,omitempty"`
	Clients          *[]string         `json:"clients,omitempty"`
	ID               *string           `json:"id,omitempty"`
	Logic            *Logic            `json:"logic,omitempty"`
	DecisionStrategy *DecisionStrategy `json:"decisionStrategy,omitempty"`
	Owner            *string           `json:"owner,omitempty"`
	Type             *string           `json:"type,omitempty"`
	Users            *[]string         `json:"users,omitempty"`
}

ResourcePolicyRepresentation is a representation of a Policy applied to a resource

func (*ResourcePolicyRepresentation) String

type ResourceRepresentation

type ResourceRepresentation struct {
	ID                 *string                      `json:"_id,omitempty"` // TODO: is marked "_optional" in template, input error or deliberate?
	Attributes         *map[string][]string         `json:"attributes,omitempty"`
	DisplayName        *string                      `json:"displayName,omitempty"`
	IconURI            *string                      `json:"icon_uri,omitempty"` // TODO: With "_" because that's how it's written down in the template
	Name               *string                      `json:"name,omitempty"`
	Owner              *ResourceOwnerRepresentation `json:"owner,omitempty"`
	OwnerManagedAccess *bool                        `json:"ownerManagedAccess,omitempty"`
	ResourceScopes     *[]ScopeRepresentation       `json:"resource_scopes,omitempty"`
	Scopes             *[]ScopeRepresentation       `json:"scopes,omitempty"`
	Type               *string                      `json:"type,omitempty"`
	URIs               *[]string                    `json:"uris,omitempty"`
}

ResourceRepresentation is a representation of a Resource

func (*ResourceRepresentation) String

func (v *ResourceRepresentation) String() string

type ResourceServerRepresentation

type ResourceServerRepresentation struct {
	AllowRemoteResourceManagement *bool                     `json:"allowRemoteResourceManagement,omitempty"`
	ClientID                      *string                   `json:"clientId,omitempty"`
	ID                            *string                   `json:"id,omitempty"`
	Name                          *string                   `json:"name,omitempty"`
	Policies                      *[]PolicyRepresentation   `json:"policies,omitempty"`
	PolicyEnforcementMode         *PolicyEnforcementMode    `json:"policyEnforcementMode,omitempty"`
	Resources                     *[]ResourceRepresentation `json:"resources,omitempty"`
	Scopes                        *[]ScopeRepresentation    `json:"scopes,omitempty"`
	DecisionStrategy              *DecisionStrategy         `json:"decisionStrategy,omitempty"`
}

ResourceServerRepresentation represents the resources of a Server

func (*ResourceServerRepresentation) String

type RetrospecTokenResult

type RetrospecTokenResult struct {
	Permissions *[]ResourcePermission `json:"permissions,omitempty"`
	Exp         *int                  `json:"exp,omitempty"`
	Nbf         *int                  `json:"nbf,omitempty"`
	Iat         *int                  `json:"iat,omitempty"`
	Aud         *StringOrArray        `json:"aud,omitempty"`
	Active      *bool                 `json:"active,omitempty"`
	AuthTime    *int                  `json:"auth_time,omitempty"`
	Jti         *string               `json:"jti,omitempty"`
	Type        *string               `json:"typ,omitempty"`
}

RetrospecTokenResult is returned when a token was checked

func (*RetrospecTokenResult) String

func (v *RetrospecTokenResult) String() string

type Role

type Role struct {
	ID                 *string                   `json:"id,omitempty"`
	Name               *string                   `json:"name,omitempty"`
	ScopeParamRequired *bool                     `json:"scopeParamRequired,omitempty"`
	Composite          *bool                     `json:"composite,omitempty"`
	Composites         *CompositesRepresentation `json:"composites,omitempty"`
	ClientRole         *bool                     `json:"clientRole,omitempty"`
	ContainerID        *string                   `json:"containerId,omitempty"`
	Description        *string                   `json:"description,omitempty"`
	Attributes         *map[string][]string      `json:"attributes,omitempty"`
}

Role is a role

func (*Role) String

func (v *Role) String() string

type RoleDefinition

type RoleDefinition struct {
	ID       *string `json:"id,omitempty"`
	Private  *bool   `json:"private,omitempty"`
	Required *bool   `json:"required,omitempty"`
}

RoleDefinition represents a role in a RolePolicyRepresentation

func (*RoleDefinition) String

func (v *RoleDefinition) String() string

type RolePolicyRepresentation

type RolePolicyRepresentation struct {
	Roles *[]RoleDefinition `json:"roles,omitempty"`
}

RolePolicyRepresentation represents role based policies

func (*RolePolicyRepresentation) String

func (v *RolePolicyRepresentation) String() string

type RolesRepresentation

type RolesRepresentation struct {
	Client *map[string][]Role `json:"client,omitempty"`
	Realm  *[]Role            `json:"realm,omitempty"`
}

RolesRepresentation represents the roles of a realm

func (*RolesRepresentation) String

func (v *RolesRepresentation) String() string

type ScopeRepresentation

type ScopeRepresentation struct {
	DisplayName *string                   `json:"displayName,omitempty"`
	IconURI     *string                   `json:"iconUri,omitempty"`
	ID          *string                   `json:"id,omitempty"`
	Name        *string                   `json:"name,omitempty"`
	Policies    *[]PolicyRepresentation   `json:"policies,omitempty"`
	Resources   *[]ResourceRepresentation `json:"resources,omitempty"`
}

ScopeRepresentation is a represents a Scope

func (*ScopeRepresentation) String

func (v *ScopeRepresentation) String() string

type ServerInfoRepesentation

type ServerInfoRepesentation struct {
	SystemInfo       *SystemInfoRepresentation `json:"systemInfo,omitempty"`
	MemoryInfo       *MemoryInfoRepresentation `json:"memoryInfo,omitempty"`
	PasswordPolicies []*PasswordPolicy         `json:"passwordPolicies,omitempty"`
}

ServerInfoRepesentation represents a server info

func (*ServerInfoRepesentation) String

func (v *ServerInfoRepesentation) String() string

type SetPasswordRequest

type SetPasswordRequest struct {
	Type      *string `json:"type,omitempty"`
	Temporary *bool   `json:"temporary,omitempty"`
	Password  *string `json:"value,omitempty"`
}

SetPasswordRequest sets a new password

func (*SetPasswordRequest) String

func (v *SetPasswordRequest) String() string

type StringOrArray

type StringOrArray []string

StringOrArray represents a value that can either be a string or an array of strings

func (*StringOrArray) MarshalJSON

func (s *StringOrArray) MarshalJSON() ([]byte, error)

MarshalJSON converts the array of strings to a JSON array or JSON string if there is only one item in the array

func (*StringOrArray) UnmarshalJSON

func (s *StringOrArray) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a string or an array object from a JSON array or a JSON string

type SystemInfoRepresentation

type SystemInfoRepresentation struct {
	FileEncoding   *string `json:"fileEncoding,omitempty"`
	JavaHome       *string `json:"javaHome,omitempty"`
	JavaRuntime    *string `json:"javaRuntime,omitempty"`
	JavaVendor     *string `json:"javaVendor,omitempty"`
	JavaVersion    *string `json:"javaVersion,omitempty"`
	JavaVM         *string `json:"javaVm,omitempty"`
	JavaVMVersion  *string `json:"javaVmVersion,omitempty"`
	OSArchitecture *string `json:"osArchitecture,omitempty"`
	OSName         *string `json:"osName,omitempty"`
	OSVersion      *string `json:"osVersion,omitempty"`
	ServerTime     *string `json:"serverTime,omitempty"`
	Uptime         *string `json:"uptime,omitempty"`
	UptimeMillis   *int    `json:"uptimeMillis,omitempty"`
	UserDir        *string `json:"userDir,omitempty"`
	UserLocale     *string `json:"userLocale,omitempty"`
	UserName       *string `json:"userName,omitempty"`
	UserTimezone   *string `json:"userTimezone,omitempty"`
	Version        *string `json:"version,omitempty"`
}

SystemInfoRepresentation represents a system info

func (*SystemInfoRepresentation) String

func (v *SystemInfoRepresentation) String() string

type TimePolicyRepresentation

type TimePolicyRepresentation struct {
	NotBefore    *string `json:"notBefore,omitempty"`
	NotOnOrAfter *string `json:"notOnOrAfter,omitempty"`
	DayMonth     *string `json:"dayMonth,omitempty"`
	DayMonthEnd  *string `json:"dayMonthEnd,omitempty"`
	Month        *string `json:"month,omitempty"`
	MonthEnd     *string `json:"monthEnd,omitempty"`
	Year         *string `json:"year,omitempty"`
	YearEnd      *string `json:"yearEnd,omitempty"`
	Hour         *string `json:"hour,omitempty"`
	HourEnd      *string `json:"hourEnd,omitempty"`
	Minute       *string `json:"minute,omitempty"`
	MinuteEnd    *string `json:"minuteEnd,omitempty"`
}

TimePolicyRepresentation represents time based policies

func (*TimePolicyRepresentation) String

func (v *TimePolicyRepresentation) String() string

type TokenOptions

type TokenOptions struct {
	ClientID            *string   `json:"client_id,omitempty"`
	ClientSecret        *string   `json:"-"`
	GrantType           *string   `json:"grant_type,omitempty"`
	RefreshToken        *string   `json:"refresh_token,omitempty"`
	Scopes              *[]string `json:"-"`
	Scope               *string   `json:"scope,omitempty"`
	ResponseTypes       *[]string `json:"-"`
	ResponseType        *string   `json:"response_type,omitempty"`
	Permission          *string   `json:"permission,omitempty"`
	Username            *string   `json:"username,omitempty"`
	Password            *string   `json:"password,omitempty"`
	Totp                *string   `json:"totp,omitempty"`
	Code                *string   `json:"code,omitempty"`
	ClientAssertionType *string   `json:"client_assertion_type,omitempty"`
	ClientAssertion     *string   `json:"client_assertion,omitempty"`
	SubjectToken        *string   `json:"subject_token,omitempty"`
	RequestedSubject    *string   `json:"requested_subject,omitempty"`
	Audience            *string   `json:"audience,omitempty"`
	RequestedTokenType  *string   `json:"requested_token_type,omitempty"`
}

TokenOptions represents the options to obtain a token

func (*TokenOptions) FormData

func (t *TokenOptions) FormData() map[string]string

FormData returns a map of options to be used in SetFormData function

func (*TokenOptions) String

func (t *TokenOptions) String() string

type User

type User struct {
	ID                         *string                     `json:"id,omitempty"`
	CreatedTimestamp           *int64                      `json:"createdTimestamp,omitempty"`
	Username                   *string                     `json:"username,omitempty"`
	Enabled                    *bool                       `json:"enabled,omitempty"`
	Totp                       *bool                       `json:"totp,omitempty"`
	EmailVerified              *bool                       `json:"emailVerified,omitempty"`
	FirstName                  *string                     `json:"firstName,omitempty"`
	LastName                   *string                     `json:"lastName,omitempty"`
	Email                      *string                     `json:"email,omitempty"`
	FederationLink             *string                     `json:"federationLink,omitempty"`
	Attributes                 *map[string][]string        `json:"attributes,omitempty"`
	DisableableCredentialTypes *[]interface{}              `json:"disableableCredentialTypes,omitempty"`
	RequiredActions            *[]string                   `json:"requiredActions,omitempty"`
	Access                     *map[string]bool            `json:"access,omitempty"`
	ClientRoles                *map[string][]string        `json:"clientRoles,omitempty"`
	RealmRoles                 *[]string                   `json:"realmRoles,omitempty"`
	Groups                     *[]string                   `json:"groups,omitempty"`
	ServiceAccountClientID     *string                     `json:"serviceAccountClientId,omitempty"`
	Credentials                *[]CredentialRepresentation `json:"credentials,omitempty"`
}

User represents the Keycloak User Structure

func (*User) String

func (v *User) String() string

type UserGroup

type UserGroup struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
	Path *string `json:"path,omitempty"`
}

UserGroup is a UserGroup

func (*UserGroup) String

func (v *UserGroup) String() string

type UserInfo

type UserInfo struct {
	Sub                 *string          `json:"sub,omitempty"`
	Name                *string          `json:"name,omitempty"`
	GivenName           *string          `json:"given_name,omitempty"`
	FamilyName          *string          `json:"family_name,omitempty"`
	MiddleName          *string          `json:"middle_name,omitempty"`
	Nickname            *string          `json:"nickname,omitempty"`
	PreferredUsername   *string          `json:"preferred_username,omitempty"`
	Profile             *string          `json:"profile,omitempty"`
	Picture             *string          `json:"picture,omitempty"`
	Website             *string          `json:"website,omitempty"`
	Email               *string          `json:"email,omitempty"`
	EmailVerified       *bool            `json:"email_verified,omitempty"`
	Gender              *string          `json:"gender,omitempty"`
	ZoneInfo            *string          `json:"zoneinfo,omitempty"`
	Locale              *string          `json:"locale,omitempty"`
	PhoneNumber         *string          `json:"phone_number,omitempty"`
	PhoneNumberVerified *bool            `json:"phone_number_verified,omitempty"`
	Address             *UserInfoAddress `json:"address,omitempty"`
	UpdatedAt           *int             `json:"updated_at,omitempty"`
}

UserInfo is returned by the userinfo endpoint https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims

func (*UserInfo) String

func (v *UserInfo) String() string

type UserInfoAddress

type UserInfoAddress struct {
	Formatted     *string `json:"formatted,omitempty"`
	StreetAddress *string `json:"street_address,omitempty"`
	Locality      *string `json:"locality,omitempty"`
	Region        *string `json:"region,omitempty"`
	PostalCode    *string `json:"postal_code,omitempty"`
	Country       *string `json:"country,omitempty"`
}

UserInfoAddress is representation of the address sub-filed of UserInfo https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim

func (*UserInfoAddress) String

func (v *UserInfoAddress) String() string

type UserPolicyRepresentation

type UserPolicyRepresentation struct {
	Users *[]string `json:"users,omitempty"`
}

UserPolicyRepresentation represents user based policies

func (*UserPolicyRepresentation) String

func (v *UserPolicyRepresentation) String() string

type UserSessionRepresentation

type UserSessionRepresentation struct {
	Clients    *map[string]string `json:"clients,omitempty"`
	ID         *string            `json:"id,omitempty"`
	IPAddress  *string            `json:"ipAddress,omitempty"`
	LastAccess *int64             `json:"lastAccess,omitempty"`
	Start      *int64             `json:"start,omitempty"`
	UserID     *string            `json:"userId,omitempty"`
	Username   *string            `json:"username,omitempty"`
}

UserSessionRepresentation represents a list of user's sessions

func (*UserSessionRepresentation) String

func (v *UserSessionRepresentation) String() string

Directories

Path Synopsis
pkg
jwx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL