keycloak

package module
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: AGPL-3.0 Imports: 21 Imported by: 0

README

Basic keycloak client in go

This repo provides a basic keycloak client in go.

Keycloak API Version Compatibility

The keycloak client in this repo is valid for the Keycloak API @v4.8.3.Final

Tokens and Refreshing

The client will fetch tokens based a realm and user credentials (username/password). The token fetched by the client will get cached in memory. On each use, the client will verify the cached token is still valid and if necessary, extend the session using the refresh token, or establish a new session using the provided credentials.

Automatic refreshing

If you would like to ensure the token cache is always warm, you can enable auto-refreshing. When the client's auth token is 5 seconds from expiration, a background process will refresh the token either by extending the session using the refresh token, or establishing a nw session using the provided credentials.

When starting automatic refresh, provide a method to handle errors when the refresh fails. This method could organize retries, panic, log the error and move on, etc. Whatever makes sense for the application using the client.

realm := "example"
username := "admin"
password := "secret"
func onFailure(err error) {
	log.Printf("Unable to auto refresh token: %v. Retrying...", err)
	// Retry after 30 seconds
	time.AfterFunc(30 * time.Second, func(){
		log.Print("Retrying auto refresh of Keycloak token")
		client.AutoRefreshToken(realm, username, password, onFailure)
	})
}
client.AutoRefreshToken(realm, username, password, onFailure)

Documentation

Index

Constants

View Source
const (
	UserSessionNoteOIDCApplicationMapperType = "oidc-usersessionmodel-note-mapper"
	UserAttributeOIDCApplicationMapperType   = "oidc-usermodel-attribute-mapper"
	GroupMembershipOIDCApplicationMapperType = "oidc-group-membership-mapper"
	RoleListSAMLApplicationMapperType        = "saml-role-list-mapper"
	UserPropertySAMLApplicationMapperType    = "saml-user-property-mapper"
)
View Source
const (
	UserFederationProviderLDAPMapperType = "org.keycloak.storage.ldap.mappers.LDAPStorageMapper"
)
View Source
const (
	UserFederationProviderType = "org.keycloak.storage.UserStorageProvider"
)

Variables

View Source
var ErrRefreshExhausted = errors.New("refresh token exhausted")

ErrRefreshExhausted indicates a refresh token has been used too many times and is no longer valid. A new token must be fetched.

View Source
var ErrSessionExpired = errors.New("auth session expired")

ErrSessionExpired indicates a login session has reached its maximum allowed time, and a new session is required to continue.

View Source
var KeycloakTokenInfoLock = &sync.Mutex{}

KeycloakTokenInfoLock allows for access control so only one routine is able to access the Keycloak Token Info

Functions

This section is empty.

Types

type AdminEventRepresentation

type AdminEventRepresentation struct {
	AuthDetails    *AuthDetailsRepresentation `json:"authDetails,omitempty"`
	Error          *string                    `json:"error,omitempty"`
	OperationType  *string                    `json:"operationType,omitempty"`
	RealmId        *string                    `json:"realmId,omitempty"`
	Representation *string                    `json:"representation,omitempty"`
	ResourcePath   *string                    `json:"resourcePath,omitempty"`
	ResourceType   *string                    `json:"resourceType,omitempty"`
	Time           *int64                     `json:"time,omitempty"`
}

type AuthDetailsRepresentation

type AuthDetailsRepresentation struct {
	ClientId  *string `json:"clientId,omitempty"`
	IpAddress *string `json:"ipAddress,omitempty"`
	RealmId   *string `json:"realmId,omitempty"`
	UserId    *string `json:"userId,omitempty"`
}

type AuthenticationExecutionExportRepresentation

type AuthenticationExecutionExportRepresentation 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            *int32  `json:"priority,omitempty"`
	Requirement         *string `json:"requirement,omitempty"`
	UserSetupAllowed    *bool   `json:"userSetupAllowed,omitempty"`
}

type AuthenticationExecutionInfoRepresentation

type AuthenticationExecutionInfoRepresentation struct {
	Alias                *string   `json:"alias,omitempty"`
	AuthenticationConfig *string   `json:"authenticationConfig,omitempty"`
	AuthenticationFlow   *bool     `json:"authenticationFlow,omitempty"`
	Configurable         *bool     `json:"configurable,omitempty"`
	DisplayName          *string   `json:"displayName,omitempty"`
	FlowId               *string   `json:"flowId,omitempty"`
	Id                   *string   `json:"id,omitempty"`
	Index                *int32    `json:"index,omitempty"`
	Level                *int32    `json:"level,omitempty"`
	ProviderId           *string   `json:"providerId,omitempty"`
	Requirement          *string   `json:"requirement,omitempty"`
	RequirementChoices   *[]string `json:"requirementChoices,omitempty"`
}

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"`
	FlowId              *string `json:"flowId,omitempty"`
	Id                  *string `json:"id,omitempty"`
	ParentFlow          *string `json:"parentFlow,omitempty"`
	Priority            *int32  `json:"priority,omitempty"`
	Requirement         *string `json:"requirement,omitempty"`
}

type AuthenticationFlowRepresentation

type AuthenticationFlowRepresentation struct {
	Alias                    *string                                        `json:"alias,omitempty"`
	AuthenticationExecutions *[]AuthenticationExecutionExportRepresentation `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"`
}

type AuthenticatorConfigInfoRepresentation

type AuthenticatorConfigInfoRepresentation struct {
	HelpText   *string                         `json:"helpText,omitempty"`
	Name       *string                         `json:"name,omitempty"`
	Properties *[]ConfigPropertyRepresentation `json:"properties,omitempty"`
	ProviderId *string                         `json:"providerId,omitempty"`
}

type AuthenticatorConfigRepresentation

type AuthenticatorConfigRepresentation struct {
	Alias  *string                 `json:"alias,omitempty"`
	Config *map[string]interface{} `json:"config,omitempty"`
	Id     *string                 `json:"id,omitempty"`
}

type CertificateRepresentation

type CertificateRepresentation struct {
	Certificate *string `json:"certificate,omitempty"`
	Kid         *string `json:"kid,omitempty"`
	PrivateKey  *string `json:"privateKey,omitempty"`
	PublicKey   *string `json:"publicKey,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the keycloak client.

func New

func New(config Config) (*Client, error)

New returns a keycloak client.

func (*Client) AddClientRolesToUserRoleMapping

func (c *Client) AddClientRolesToUserRoleMapping(accessToken string, realmName, userID, clientID string, roles []RoleRepresentation) error

AddClientRoleMapping add client-level roles to the user role mapping.

func (*Client) AddDefaultClientScope added in v0.0.13

func (c *Client) AddDefaultClientScope(accessToken string, realmName, client, scope string) error

AddDefaultClientScope changes the default client scopes for a realm to add the scope represented by scopeId PUT /auth/admin/realms/demorealm/clients/0d55d933-09f4-427d-a385-13f5ceb1656e/default-client-scopes/7efa02d9-0a1e-496d-abf7-d9edb80e47b3 HTTP/1.1 204

func (*Client) AddDefaultGroup added in v0.0.18

func (c *Client) AddDefaultGroup(accessToken string, realmName string, groupID string) error

AddDefaultGroup places a new group for in the default realm groups by ID

func (*Client) AddGroupClientRoleMappings added in v0.0.10

func (c *Client) AddGroupClientRoleMappings(accessToken, realmName, groupId, clientId string, roleMappings []RoleRepresentation) error

AddGroupClientRoleMappings adds client role mappings for a group, returning error (if any) > POST http://localhost:8000/auth/admin/realms/demo/groups/80206962-5dcb-4252-8cbb-2e828c1d010b/role-mappings/clients/a3bdb226-f718-4c69-9f59-76df1dda1362 ```json [

{
  "id": "945ae18b-5cd5-48c5-9fa8-e5b43555d71f",
  "name": "Admin",
  "description": "Allow all.",
  "composite": false,
  "clientRole": true,
  "containerId": "a3bdb226-f718-4c69-9f59-76df1dda1362"
}

]

func (*Client) AddGroupRealmRoleMappings added in v0.0.10

func (c *Client) AddGroupRealmRoleMappings(accessToken, realmName, groupId string, roleMappings []RoleRepresentation) error

AddGroupRealmRoleMappings adds realm role mapping(s) for the group, returning error (if any). > POST http://localhost:8000/auth/admin/realms/demo/groups/80206962-5dcb-4252-8cbb-2e828c1d010b/role-mappings/realm ```json [

{
  "id": "f815fc8a-5eb6-46c1-a454-5fbc8e1c6492",
  "name": "offline_access",
  "description": "${role_offline-access}",
  "composite": false,
  "clientRole": false,
  "containerId": "4f0f8206-0ec4-4fd6-99eb-4e8c4b986c43"
}

] ```

func (*Client) AddOptionalClientScope added in v0.0.13

func (c *Client) AddOptionalClientScope(accessToken string, realmName, client, scope string) error

AddOptionalClientScope changes the optional client scopes for a realm to add the scope represented by scopeId PUT /auth/admin/realms/demorealm/clients/0d55d933-09f4-427d-a385-13f5ceb1656e/optional-client-scopes/7efa02d9-0a1e-496d-abf7-d9edb80e47b3 HTTP/1.1 204

func (*Client) AddRealmDefaultClientScope added in v0.0.13

func (c *Client) AddRealmDefaultClientScope(accessToken string, realmName, scope string) error

AddRealmDefaultClientScope changes the default client scopes for a realm to add the scope represented by scopeId PUT /auth/admin/realms/demorealm/default-default-client-scopes/2c683450-ae2d-48ef-ace3-bc9101b2c4d1 HTTP/1.1 204

func (*Client) AddRealmOptionalClientScope added in v0.0.13

func (c *Client) AddRealmOptionalClientScope(accessToken string, realmName, scope string) error

AddRealmOptionalClientScope changes the optional client scopes for a realm to add the scope represented by scopeId PUT /auth/admin/realms/demorealm/default-optional-client-scopes/2c683450-ae2d-48ef-ace3-bc9101b2c4d1 HTTP/1.1 204

func (*Client) AutoRefreshToken added in v0.0.16

func (c *Client) AutoRefreshToken(realm string, username string, password string, onFailure func(error))

AutoRefreshToken starts a process where an access token is kept perpetually warm in the cache, refreshing itself five seconds before it expires.

func (*Client) CancelAutoRefreshToken added in v0.0.16

func (c *Client) CancelAutoRefreshToken(realm string, username string)

CancelAutoRefreshToken turns off the auto-refresh loop for a token. It will still get cached on use, but the cache is not guaranteed to be warm.

func (*Client) ClearAllLoginFailures

func (c *Client) ClearAllLoginFailures(accessToken string, realmName string) error

ClearAllLoginFailures clears any user login failures for all users. This can release temporary disabled users.

func (*Client) ClearUserLoginFailures

func (c *Client) ClearUserLoginFailures(accessToken string, realmName, userID string) error

ClearUserLoginFailures clear any user login failures for the user. This can release temporary disabled user.

func (*Client) CopyExistingAuthenticationFlow

func (c *Client) CopyExistingAuthenticationFlow(accessToken string, realmName, flowAlias, newName string) error

CopyExistingAuthenticationFlow copy the existing authentication flow under a new name. 'flowAlias' is the name of the existing authentication flow, 'newName' is the new name of the authentication flow.

func (*Client) CountUsers

func (c *Client) CountUsers(accessToken string, realmName string) (int, error)

CountUsers returns the number of users in the realm.

func (*Client) CreateAuthenticationExecution

func (c *Client) CreateAuthenticationExecution(accessToken string, realmName string, authExec AuthenticationExecutionRepresentation) (string, error)

CreateAuthenticationExecution add new authentication execution

func (*Client) CreateAuthenticationExecutionForFlow

func (c *Client) CreateAuthenticationExecutionForFlow(accessToken string, realmName, flowAlias, provider string) (string, error)

CreateAuthenticationExecutionForFlow add a new authentication execution to a flow. 'flowAlias' is the alias of the parent flow.

func (*Client) CreateAuthenticationFlow

func (c *Client) CreateAuthenticationFlow(accessToken string, realmName string, authFlow AuthenticationFlowRepresentation) (string, error)

CreateAuthenticationFlow creates a new authentication flow.

func (*Client) CreateClient added in v0.0.4

func (c *Client) CreateClient(accessToken string, realmName string, client ClientCreateRequest) (string, error)

CreateClient creates a client

func (*Client) CreateClientInitialAccess

func (c *Client) CreateClientInitialAccess(accessToken string, realmName string, access ClientInitialAccessCreatePresentation) (ClientInitialAccessPresentation, error)

CreateClientInitialAccess creates a new initial access token.

func (*Client) CreateClientRole

func (c *Client) CreateClientRole(accessToken string, realmName string, clientID string, role RoleRepresentation) (string, error)

CreateClientRole creates a new role for the realm or client

func (*Client) CreateFlowWithExecutionForExistingFlow

func (c *Client) CreateFlowWithExecutionForExistingFlow(accessToken string, realmName, flowAlias, alias, flowType, provider, description string) (string, error)

CreateFlowWithExecutionForExistingFlow add a new flow with a new execution to an existing flow. 'flowAlias' is the alias of the parent authentication flow.

func (*Client) CreateGroup added in v0.0.9

func (c *Client) CreateGroup(accessToken string, realmName string, group GroupRepresentation) (string, error)

CreateGroup creates a new group for the realm

func (*Client) CreateProtocolMapper added in v0.0.14

func (c *Client) CreateProtocolMapper(accessToken string, realmName string, clientId string, protocolMapper ProtocolMapperRepresentation) (string, error)

CreateProtocolMapper creates a new protocol mapper for the client

func (*Client) CreateRealm

func (c *Client) CreateRealm(accessToken string, realm RealmRepresentation) (string, error)

CreateRealm creates the realm from its RealmRepresentation.

func (*Client) CreateRealmRole added in v0.0.11

func (c *Client) CreateRealmRole(accessToken string, realmName string, role RoleRepresentation) (string, error)

CreateRealmRole creates a new role for the specified realm POST /auth/admin/realms/demorealm/roles HTTP/1.1 {"name":"Admin Role","description":"Allow all."} 201 Header: Location: http://localhost:8000/auth/admin/realms/demorealm/roles/Admin%sRole

func (*Client) CreateUser

func (c *Client) CreateUser(accessToken string, reqRealmName, targetRealmName string, user UserRepresentation) (string, error)

CreateUser creates the user from its UserRepresentation. The username must be unique.

func (*Client) CreateUserFederationProvider added in v0.0.7

func (c *Client) CreateUserFederationProvider(accessToken string, realmName string, userFederationProvider UserFederationProviderRepresentation) (string, error)

CreateUserFederationProvider creates a user federation provider for a realm for syncing users from an external source, returning the location of the created provider or error (if any).

func (*Client) CreateUserFederationProviderMapper added in v0.0.7

func (c *Client) CreateUserFederationProviderMapper(accessToken string, realmName string, userFederationProviderMapper UserFederationProviderMapperRepresentation) (string, error)

CreateUserFederationProviderMapper creates a user federation provider mapper for a realm for mapping attributes from synced users from an external source, returning the location of the created provider mapper or error (if any).

func (*Client) DeleteAuthenticationExecution

func (c *Client) DeleteAuthenticationExecution(accessToken string, realmName, executionID string) error

DeleteAuthenticationExecution deletes the execution.

func (*Client) DeleteAuthenticationFlow

func (c *Client) DeleteAuthenticationFlow(accessToken string, realmName, flowID string) error

DeleteAuthenticationFlow deletes an authentication flow.

func (*Client) DeleteAuthenticatorConfig

func (c *Client) DeleteAuthenticatorConfig(accessToken string, realmName, configID string) error

DeleteAuthenticatorConfig deletes the authenticator configuration.

func (*Client) DeleteClient added in v0.0.6

func (c *Client) DeleteClient(accessToken string, realmName, id string) error

DeleteClient deletes specified client from the realm. id is the id of client (not client-id).

func (*Client) DeleteClientInitialAccess

func (c *Client) DeleteClientInitialAccess(accessToken string, realmName, accessID string) error

DeleteClientInitialAccess deletes the client initial access.

func (*Client) DeleteClientRolesFromUserRoleMapping

func (c *Client) DeleteClientRolesFromUserRoleMapping(accessToken string, realmName, userID, clientID string) error

DeleteClientRolesFromUserRoleMapping deletes client-level roles from user role mapping.

func (*Client) DeleteCredentialsForUser

func (c *Client) DeleteCredentialsForUser(accessToken string, realmReq, realmName string, userID string, credentialID string) error

DeleteCredentialsForUser remove credentials for a user

func (*Client) DeleteGroup added in v0.0.9

func (c *Client) DeleteGroup(accessToken string, realmName string, groupID string) error

DeleteGroup deletes a group from the realm

func (*Client) DeleteProtocolMapper added in v0.0.14

func (c *Client) DeleteProtocolMapper(accessToken string, realmName string, clientId string, protocolMapperID string) error

DeleteProtocolMapper deletes a protocol mapper from the client

func (*Client) DeleteRealm

func (c *Client) DeleteRealm(accessToken string, realmName string) error

DeleteRealm deletes the realm.

func (*Client) DeleteRealmRole added in v0.0.11

func (c *Client) DeleteRealmRole(accessToken string, realmName string, roleId string) error

DeleteRealmRole deletes the specified role from the specified realm DELETE /auth/admin/realms/demorealm/roles-by-id/c4d3c739-ad50-421e-a9af-63b04ae4105d HTTP/1.1

func (*Client) DeleteRequiredAction

func (c *Client) DeleteRequiredAction(accessToken string, realmName, actionAlias string) error

DeleteRequiredAction deletes the required action.

func (*Client) DeleteRole added in v0.0.9

func (c *Client) DeleteRole(accessToken string, realmName string, clientID string, roleID string) error

DeleteRole deletes a role

func (*Client) DeleteUser

func (c *Client) DeleteUser(accessToken string, realmName, userID string) error

DeleteUser deletes the user.

func (*Client) DeleteUserFederationProvider added in v0.0.7

func (c *Client) DeleteUserFederationProvider(accessToken string, realmName, userFederationProviderID string) error

DeleteUserFederationProvider deletes the specified UserFederationProvider from the realm.

func (*Client) DeleteUserFederationProviderMapper added in v0.0.7

func (c *Client) DeleteUserFederationProviderMapper(accessToken string, realmName, userFederationProviderMapperID string) error

DeleteUserFederationProviderMapper deletes the specified UserFederationProviderMapper from the realm.

func (*Client) ExecuteActionsEmail

func (c *Client) ExecuteActionsEmail(accessToken string, realmName string, userID string, actions []string, paramKV ...string) error

ExecuteActionsEmail sends an update account email to the user. An email contains a link the user can click to perform a set of required actions.

func (*Client) ExpireSession added in v0.0.20

func (c *Client) ExpireSession(accessToken, realmName, sessionToken string) error

ExpireSession clears a session based on a valid session token

func (*Client) ExportRealm

func (c *Client) ExportRealm(accessToken string, realmName string) (RealmRepresentation, error)

ExportRealm recovers the full realm.

func (*Client) FetchToken added in v0.0.15

func (c *Client) FetchToken(realm string, username string, password string) (*TokenInfo, error)

FetchToken fetches a valid token from keycloak.

func (*Client) GenerateCertificate

func (c *Client) GenerateCertificate(accessToken string, realmName, idClient, attr string) (CertificateRepresentation, error)

GenerateCertificate generates a new certificate with new key pair. idClient is the id of client (not client-id).

func (*Client) GenerateKeyPairAndCertificate

func (c *Client) GenerateKeyPairAndCertificate(accessToken string, realmName, idClient, attr string, keyStoreConfig KeyStoreConfig) ([]byte, error)

GenerateKeyPairAndCertificate generates a keypair and certificate and serves the private key in a specified keystore format.

func (*Client) GetAttackDetectionStatus

func (c *Client) GetAttackDetectionStatus(accessToken string, realmName, userID string) (map[string]interface{}, error)

GetAttackDetectionStatus gets the status of a username in brute force detection.

func (*Client) GetAuthenticationExecutionForFlow

func (c *Client) GetAuthenticationExecutionForFlow(accessToken string, realmName, flowAlias string) ([]AuthenticationExecutionInfoRepresentation, error)

GetAuthenticationExecutionForFlow returns the authentication executions for a flow.

func (*Client) GetAuthenticationFlow

func (c *Client) GetAuthenticationFlow(accessToken string, realmName, flowID string) (AuthenticationFlowRepresentation, error)

GetAuthenticationFlow gets the authentication flow for id.

func (*Client) GetAuthenticationFlows

func (c *Client) GetAuthenticationFlows(accessToken string, realmName string) ([]AuthenticationFlowRepresentation, error)

GetAuthenticationFlows returns a list of authentication flows.

func (*Client) GetAuthenticatorConfig

func (c *Client) GetAuthenticatorConfig(accessToken string, realmName, configID string) (AuthenticatorConfigRepresentation, error)

GetAuthenticatorConfig returns the authenticator configuration.

func (*Client) GetAuthenticatorProviderConfig

func (c *Client) GetAuthenticatorProviderConfig(accessToken string, realmName, providerID string) (AuthenticatorConfigInfoRepresentation, error)

GetAuthenticatorProviderConfig returns the authenticator provider’s configuration description.

func (*Client) GetAuthenticatorProviders

func (c *Client) GetAuthenticatorProviders(accessToken string, realmName string) ([]map[string]interface{}, error)

GetAuthenticatorProviders returns a list of authenticator providers.

func (*Client) GetClient

func (c *Client) GetClient(accessToken string, realmName, idClient string) (ClientRepresentation, error)

GetClient get the representation of the client. idClient is the id of client (not client-id).

func (*Client) GetClientAuthenticatorProviders

func (c *Client) GetClientAuthenticatorProviders(accessToken string, realmName string) ([]map[string]interface{}, error)

GetClientAuthenticatorProviders returns a list of client authenticator providers.

func (*Client) GetClientInitialAccess

func (c *Client) GetClientInitialAccess(accessToken string, realmName string) ([]ClientInitialAccessPresentation, error)

GetClientInitialAccess returns a list of clients initial access.

func (*Client) GetClientRegistrationPolicy

func (c *Client) GetClientRegistrationPolicy(accessToken string, realmName, configID string) ([]ComponentTypeRepresentation, error)

GetClientRegistrationPolicy is the base path to retrieve providers with the configProperties properly filled.

func (*Client) GetClientRole added in v0.0.9

func (c *Client) GetClientRole(accessToken string, realmName string, clientID string, roleID string) (RoleRepresentation, error)

GetClientRole gets a specific client role’s representation

func (*Client) GetClientRoleMappings

func (c *Client) GetClientRoleMappings(accessToken string, realmName, userID, clientID string) ([]RoleRepresentation, error)

GetClientRoleMappings gets client-level role mappings for the user, and the app.

func (*Client) GetClientRoles

func (c *Client) GetClientRoles(accessToken string, realmName string, clientID string) ([]RoleRepresentation, error)

GetClientRoles gets all roles for the realm or client

func (*Client) GetClients

func (c *Client) GetClients(accessToken string, realmName string, paramKV ...string) ([]ClientRepresentation, error)

GetClients returns a list of clients belonging to the realm. Parameters: clientId (filter by clientId), viewableOnly (filter clients that cannot be viewed in full by admin, default="false")

func (*Client) GetConfigDescriptionForClients

func (c *Client) GetConfigDescriptionForClients(accessToken string, realmName string) (map[string]interface{}, error)

GetConfigDescriptionForClients returns the configuration descriptions for all clients.

func (*Client) GetCredentialsForUser

func (c *Client) GetCredentialsForUser(accessToken string, realmReq, realmName string, userID string) ([]CredentialRepresentation, error)

GetCredentialsForUser gets the credential list for a user

func (*Client) GetDefaultClientScopes added in v0.0.13

func (c *Client) GetDefaultClientScopes(accessToken string, realmName, client string) ([]ClientScopeRepresentation, error)

GetDefaultClientScopes gets realm configuration for scopes which are added as client default scopes when a new client is created GET /auth/admin/realms/demorealm/clients/0d55d933-09f4-427d-a385-13f5ceb1656e/default-client-scopes HTTP/1.1 [

{
    "id":"3f4f9602-f843-48a6-9d24-0f9563eed5b0",
    "name":"profile"
},
{
    "id":"7efa02d9-0a1e-496d-abf7-d9edb80e47b3",
    "name":"email"
},
{
    "id":"2c683450-ae2d-48ef-ace3-bc9101b2c4d1",
    "name":"web-origins"
}

]

func (*Client) GetDefaultGroups added in v0.0.18

func (c *Client) GetDefaultGroups(accessToken string, realmName string) ([]GroupRepresentation, error)

GetDefaultGroups fetches the list of default groups for a realm

func (*Client) GetFormActionProviders

func (c *Client) GetFormActionProviders(accessToken string, realmName string) ([]map[string]interface{}, error)

GetFormActionProviders returns a list of form action providers.

func (*Client) GetFormProviders

func (c *Client) GetFormProviders(accessToken string, realmName string) ([]map[string]interface{}, error)

GetFormProviders returns a list of form providers.

func (*Client) GetGroup

func (c *Client) GetGroup(accessToken string, realmName string, groupID string) (GroupRepresentation, error)

GetGroup gets a specific group’s representation

func (*Client) GetGroupClientRoleMappings added in v0.0.10

func (c *Client) GetGroupClientRoleMappings(accessToken, realmName, groupId, clientId string) ([]RoleRepresentation, error)

GetGroupClientRoleMappings returns the assigned client roles for a group and error (if any). > GET http://localhost:8000/auth/admin/realms/demo/groups/80206962-5dcb-4252-8cbb-2e828c1d010b/role-mappings/clients/a3bdb226-f718-4c69-9f59-76df1dda1362 ```json [

{
  "id": "945ae18b-5cd5-48c5-9fa8-e5b43555d71f",
  "name": "Admin",
  "description": "Allow all.",
  "composite": false,
  "clientRole": true,
  "containerId": "a3bdb226-f718-4c69-9f59-76df1dda1362"
}

]

func (*Client) GetGroupRealmRoleMappings added in v0.0.10

func (c *Client) GetGroupRealmRoleMappings(accessToken, realmName, groupId string) ([]RoleRepresentation, error)

GetGroupRealmRoleMappings get the realm level roles for the group or error (if any). > GET http://localhost:8000/auth/admin/realms/demo/groups/80206962-5dcb-4252-8cbb-2e828c1d010b/role-mappings/realm ```json [

{
  "id": "f815fc8a-5eb6-46c1-a454-5fbc8e1c6492",
  "name": "offline_access",
  "description": "${role_offline-access}",
  "composite": false,
  "clientRole": false,
  "containerId": "4f0f8206-0ec4-4fd6-99eb-4e8c4b986c43"
}

] ```

func (*Client) GetGroups

func (c *Client) GetGroups(accessToken string, realmName string) ([]GroupRepresentation, error)

GetGroups gets all groups for the realm

func (*Client) GetGroupsOfUser

func (c *Client) GetGroupsOfUser(accessToken string, realmName, userID string) ([]GroupRepresentation, error)

GetGroupsOfUser get the groups of the user.

func (*Client) GetKeyInfo

func (c *Client) GetKeyInfo(accessToken string, realmName, idClient, attr string) (CertificateRepresentation, error)

GetKeyInfo returns the key info. idClient is the id of client (not client-id).

func (*Client) GetKeyStore

func (c *Client) GetKeyStore(accessToken string, realmName, idClient, attr string, keyStoreConfig KeyStoreConfig) ([]byte, error)

GetKeyStore returns a keystore file for the client, containing private key and public certificate. idClient is the id of client (not client-id).

func (*Client) GetOptionalClientScopes added in v0.0.13

func (c *Client) GetOptionalClientScopes(accessToken string, realmName, client string) ([]ClientScopeRepresentation, error)

GetOptionalClientScopes gets realm configuration for scopes which are added as client optional scopes when a new client is created GET /auth/admin/realms/demorealm/clients/0d55d933-09f4-427d-a385-13f5ceb1656e/optional-client-scopes HTTP/1.1 [

{
    "id":"3f4f9602-f843-48a6-9d24-0f9563eed5b0",
    "name":"profile"
},
{
    "id":"7efa02d9-0a1e-496d-abf7-d9edb80e47b3",
    "name":"email"
},
{
    "id":"2c683450-ae2d-48ef-ace3-bc9101b2c4d1",
    "name":"web-origins"
}

]

func (*Client) GetProtocolMapper added in v0.0.14

func (c *Client) GetProtocolMapper(accessToken string, realmName string, clientId string, protocolmapperID string) (ProtocolMapperRepresentation, error)

GetProtocolMapper gets a specific protocol mapper’s representation

func (*Client) GetProtocolMappers added in v0.0.14

func (c *Client) GetProtocolMappers(accessToken string, realmName string, clientId string, protocol string) ([]ProtocolMapperRepresentation, error)

GetProtocolMappers gets all mappers of a given protocol for the client

func (*Client) GetRealm

func (c *Client) GetRealm(accessToken string, realmName string) (RealmRepresentation, error)

GetRealm get the top level represention of the realm. Nested information like users are not included.

func (*Client) GetRealmDefaultClientScopes added in v0.0.13

func (c *Client) GetRealmDefaultClientScopes(accessToken string, realmName string) ([]ClientScopeRepresentation, error)

GetRealmDefaultClientScopes gets realm configuration for scopes which are added as client default scopes when a new client is created GET /auth/admin/realms/demorealm/default-default-client-scopes HTTP/1.1 [

{
    "id":"3f4f9602-f843-48a6-9d24-0f9563eed5b0",
    "name":"profile"
},
{
    "id":"7efa02d9-0a1e-496d-abf7-d9edb80e47b3",
    "name":"email"
},
{
    "id":"2c683450-ae2d-48ef-ace3-bc9101b2c4d1",
    "name":"web-origins"
}

]

func (*Client) GetRealmLevelRoleMappings

func (c *Client) GetRealmLevelRoleMappings(accessToken string, realmName, userID string) ([]RoleRepresentation, error)

func (*Client) GetRealmOptionalClientScopes added in v0.0.13

func (c *Client) GetRealmOptionalClientScopes(accessToken string, realmName string) ([]ClientScopeRepresentation, error)

GetRealmOptionalClientScopes gets realm configuration for scopes which are added as client optional scopes when a new client is created GET /auth/admin/realms/demorealm/default-optional-client-scopes HTTP/1.1 [

{
    "id":"3f4f9602-f843-48a6-9d24-0f9563eed5b0",
    "name":"profile"
},
{
    "id":"7efa02d9-0a1e-496d-abf7-d9edb80e47b3",
    "name":"email"
},
{
    "id":"2c683450-ae2d-48ef-ace3-bc9101b2c4d1",
    "name":"web-origins"
}

]

func (*Client) GetRealmRoleByID added in v0.0.11

func (c *Client) GetRealmRoleByID(accessToken string, realmName string, roleId string) (RoleRepresentation, error)

GetRealmRole gets a specific realm role’s representation GET /auth/admin/realms/demorealm/roles-by-id/f19e86ad-ddf2-4397-9a36-63bf02119fe8

{
    "id": "f19e86ad-ddf2-4397-9a36-63bf02119fe8",
    "name": "offline_access",
    "description": "${role_offline-access}",
    "composite": false,
    "clientRole": false,
    "containerId": "b0b76f0e-3405-4d43-97da-4556d4cff122",
    "attributes": {}
}

func (*Client) GetRealmRoleByName added in v0.0.11

func (c *Client) GetRealmRoleByName(accessToken string, realmName string, roleName string) (RoleRepresentation, error)

GetRealmRole gets a specific realm role’s representation GET /auth/admin/realms/demorealm/roles/Admin HTTP/1.1

{
    "id": "c4d3c739-ad50-421e-a9af-63b04ae4105d",
    "name": "Admin",
    "description": "Allow all.",
    "composite": false,
    "clientRole": false,
    "containerId": "b0b76f0e-3405-4d43-97da-4556d4cff122",
    "attributes": {}
}

func (*Client) GetRealmRoles added in v0.0.11

func (c *Client) GetRealmRoles(accessToken string, realmName string) ([]RoleRepresentation, error)

GetRealmRoles gets all roles for the realm GET /auth/admin/realms/demorealm/roles HTTP/1.1

[{
    "id": "f19e86ad-ddf2-4397-9a36-63bf02119fe8",
    "name": "offline_access",
    "description": "${role_offline-access}",
    "composite": false,
    "clientRole": false,
    "containerId": "b0b76f0e-3405-4d43-97da-4556d4cff122"
}, {
    "id": "1776d0d5-5ed6-49fa-83fc-f589b9c43eed",
    "name": "uma_authorization",
    "description": "${role_uma_authorization}",
    "composite": false,
    "clientRole": false,
    "containerId": "b0b76f0e-3405-4d43-97da-4556d4cff122"
}]

func (*Client) GetRealms

func (c *Client) GetRealms(accessToken string) ([]RealmRepresentation, error)

GetRealms get the top level represention of all the realms. Nested information like users are not included.

func (*Client) GetRequiredAction

func (c *Client) GetRequiredAction(accessToken string, realmName, actionAlias string) (RequiredActionProviderRepresentation, error)

GetRequiredAction returns the required action for the alias.

func (*Client) GetRequiredActions

func (c *Client) GetRequiredActions(accessToken string, realmName string) ([]RequiredActionProviderRepresentation, error)

GetRequiredActions returns a list of required actions.

func (*Client) GetSAMLDescription added in v0.0.14

func (c *Client) GetSAMLDescription(accessToken string, realmName string, idClient string, format string) (string, error)

GetSAMLDescription gets the saml description for a client. idClient is the id of client (not client-id). GET https://id.tozny.com/auth/admin/realms/demorealm/clients/13be9337-b349-4e1a-9b1a-32fd227e0d0f/installation/providers/saml-idp-descriptor <?xml version="1.0" encoding="UTF-8"?> <EntityDescriptor entityID="https://id.tozny.com/auth/realms/demorealm"

                xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
                xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IDPSSODescriptor WantAuthnRequestsSigned="false"
   protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
   <SingleLogoutService
      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
      Location="https://id.tozny.com/auth/realms/demorealm/protocol/saml" />
   <SingleLogoutService
      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
      Location="https://id.tozny.com/auth/realms/demorealm/protocol/saml" />
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
   <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
      Location="https://id.tozny.com/auth/realms/demorealm/protocol/saml" />
   <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
      Location="https://id.tozny.com/auth/realms/demorealm/protocol/saml" />
   <KeyDescriptor use="signing">
     <dsig:KeyInfo>
       <dsig:KeyName>xKHm8qTWp9Dppc6jOtcKkN8thWLSJ8OVHeVND7rH-1s</dsig:KeyName>
       <dsig:X509Data>
         <dsig:X509Certificate>MIICoTCCAYkCBgF1BX2OcTANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAlkZW1vcmVhbG0wHhcNMjAxMDA3MjM1MzM1WhcNMzAxMDA3MjM1NTE1WjAUMRIwEAYDVQQDDAlkZW1vcmVhbG0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCnwsBYFAnxrr36yjXen3+2LxuDqeBl7+qy+qkAOD91Pe7gokeY9aXkyQedb4kII37i6iPAwtCHg/PjwU3unufqB8hGmy/GTdq95u8DOrKcFDutNG8P/51qxGTDZVni5NzO6kchXSK/RHJgi47vbmPN7MzLZopuw2q1ulXmPkRYEGNALuW3Ofv8AwdvADRj7+Fq7VpIZmHsgMS+ujnnMYtISqENDP5qXAm+k2Ux69rgba5hNcFwwu9sipD+Ybc6MxtQxcKJh9ciPLoq+HYFpoF5uiBSzbgCZ7mrK/7/dZrrYC73+65ZGt6f0VHWMVjwpKUkqlCYOxGqRx7lrpZ967wfAgMBAAEwDQYJKoZIhvcNAQELBQADggEBABTSiOQ+Gi5Qer3nf7xoXbYuzv5/RwcilWOrnEmqLiM84nkH1nAiF0axDBFUv5NpqqEEb2VyyZz+pIfLiEhPwjpy03t24XLAz+S9CsQW7LNtfVobrf52dzofe/5NHymq2WtnBeOtt7HSgHVPUmTzBbA3HDKP5N4p359j32ElxcgSZOmC2IFNDcoVC39pylmTHuZ6MGOD6skeIANXxtU77HKPATLl9AkxOz7k5y+AiBJjsTmYxZVhhr72+8jyumeWq30K8SeO5CryU+JFvz5rljacZspGEgWoqaiqXxtENs9+K29lB1EB9delhSJkZ+u7gxQwkSTVYhkS6FZQfH2tuTE=</dsig:X509Certificate>
       </dsig:X509Data>
     </dsig:KeyInfo>
   </KeyDescriptor>
</IDPSSODescriptor>

</EntityDescriptor>

func (*Client) GetSAMLDescriptor added in v0.0.19

func (c *Client) GetSAMLDescriptor(realmName string) (string, error)

GetSAMLDescriptor fetches the public XML IDP descriptor document for a realm

func (*Client) GetSecret

func (c *Client) GetSecret(accessToken string, realmName, idClient string) (CredentialRepresentation, error)

GetSecret get the client secret. idClient is the id of client (not client-id).

func (*Client) GetToken

func (c *Client) GetToken(realm string, username string, password string) (string, error)

GetToken returns a valid token from the cache or from keycloak as needed.

func (*Client) GetTokenInfo added in v0.0.16

func (c *Client) GetTokenInfo(realm string, username string, password string, force bool) (*TokenInfo, error)

GetTokenInfo fetches a set of token info, from the cache, or from the server, refreshing as necessary by either starting a new session, or utilizing the refresh token to extend the current session

func (*Client) GetUnregisteredRequiredActions

func (c *Client) GetUnregisteredRequiredActions(accessToken string, realmName string) ([]map[string]interface{}, error)

GetUnregisteredRequiredActions returns a list of unregistered required actions.

func (*Client) GetUser

func (c *Client) GetUser(accessToken string, realmName, userID string) (UserRepresentation, error)

GetUser get the represention of the user.

func (*Client) GetUserDetails added in v0.0.8

func (c *Client) GetUserDetails(accessToken string, realmName, username string) (UserDetailsRepresentation, error)

GetUserDetails gets a detailed represention of the user with resolved groups and roles.

func (*Client) GetUserFederationProvider added in v0.0.7

func (c *Client) GetUserFederationProvider(accessToken string, realmName, userFederationProviderID string) (UserFederationProviderRepresentation, error)

GetUserFederationProvider returns the representation of the specified UserFederationProvider or error (if any).

func (*Client) GetUserFederationProviderMapper added in v0.0.7

func (c *Client) GetUserFederationProviderMapper(accessToken string, realmName, userFederationProviderMapperID string) (UserFederationProviderMapperRepresentation, error)

GetUserFederationProviderMapper returns the representation of the specified UserFederationProviderMapper or error (if any).

func (*Client) GetUserFederationProviderMappers added in v0.0.7

func (c *Client) GetUserFederationProviderMappers(accessToken string, realmName string, userFederationProviderID string, mapperType string) ([]UserFederationProviderMapperRepresentation, error)

GetUserFederationProviderMappers returns a list of UserFederationProviderMappers belonging to the realm or error (if any).

func (*Client) GetUserFederationProviders added in v0.0.7

func (c *Client) GetUserFederationProviders(accessToken string, realmName string, realmId string) ([]UserFederationProviderRepresentation, error)

GetUserFederationProviders returns a list of UserFederationProviders belonging to the realm or error (if any).

func (*Client) GetUsers

func (c *Client) GetUsers(accessToken string, reqRealmName, targetRealmName string, paramKV ...string) (Users, error)

GetUsers returns a list of users, filtered according to the query parameters. Parameters: email, first (paging offset, int), firstName, lastName, username, max (maximum result size, default = 100), search (string contained in username, firstname, lastname or email)

func (*Client) InitiateLogin added in v0.0.22

func (c *Client) InitiateLogin(realmName string, loginURLEncoded InitiatePKCELogin) (*http.Response, error)

InitiateLogin begins the login flow

func (*Client) JoinGroup added in v0.0.18

func (c *Client) JoinGroup(accessToken string, realmName, userID, groupID string) error

JoinGroup adds a user to a group by ID.

func (*Client) LeaveGroup added in v0.0.18

func (c *Client) LeaveGroup(accessToken string, realmName, userID, groupID string) error

LeaveGroup removes a user from a group by ID.

func (*Client) LogRequests added in v0.0.17

func (c *Client) LogRequests(logger RequestLogger)

LogRequests sets up a client plugin to log requests

func (*Client) LowerExecutionPriority

func (c *Client) LowerExecutionPriority(accessToken string, realmName, executionID string) error

LowerExecutionPriority lowers the execution’s priority.

func (*Client) RaiseExecutionPriority

func (c *Client) RaiseExecutionPriority(accessToken string, realmName, executionID string) error

RaiseExecutionPriority raise the execution’s priority.

func (*Client) RefreshToken added in v0.0.15

func (c *Client) RefreshToken(realm string, info *TokenInfo) (*TokenInfo, error)

RefreshToken fetches a valid token from keycloak using the refresh token.

func (*Client) RegisterRequiredAction

func (c *Client) RegisterRequiredAction(accessToken string, realmName, providerID, name string) error

RegisterRequiredAction register a new required action.

func (*Client) RemoveDefaultClientScope added in v0.0.13

func (c *Client) RemoveDefaultClientScope(accessToken string, realmName, client, scope string) error

RemoveDefaultClientScope changes the default client scopes for a realm to add the scope represented by scopeId DELETE /auth/admin/realms/demorealm/clients/0d55d933-09f4-427d-a385-13f5ceb1656e/default-client-scopes/7efa02d9-0a1e-496d-abf7-d9edb80e47b3 HTTP/1.1 204

func (*Client) RemoveDefaultGroup added in v0.0.18

func (c *Client) RemoveDefaultGroup(accessToken string, realmName string, groupID string) error

RemoveDefaultGroup deletes removes a group from the realm default groups list by ID

func (*Client) RemoveGroupClientRoleMappings added in v0.0.10

func (c *Client) RemoveGroupClientRoleMappings(accessToken, realmName, groupId, clientId string, roleMappings []RoleRepresentation) error

RemoveGroupClientRoleMappings removes client role mapping(s) from a group, returning error (if any) > DELETE http://localhost:8000/auth/admin/realms/demo/groups/80206962-5dcb-4252-8cbb-2e828c1d010b/role-mappings/clients/a3bdb226-f718-4c69-9f59-76df1dda1362 ```json [

{
  "id": "945ae18b-5cd5-48c5-9fa8-e5b43555d71f",
  "name": "Admin",
  "description": "Allow all.",
  "composite": false,
  "clientRole": true,
  "containerId": "a3bdb226-f718-4c69-9f59-76df1dda1362"
}

]

func (*Client) RemoveGroupRealmRoleMappings added in v0.0.10

func (c *Client) RemoveGroupRealmRoleMappings(accessToken, realmName, groupId string, roleMappings []RoleRepresentation) error

RemoveGroupRealmRoleMappings removes realm role mapping(s) from the group > DELETE http://localhost:8000/auth/admin/realms/demo/groups/80206962-5dcb-4252-8cbb-2e828c1d010b/role-mappings/realm ```json [

{
  "id": "f815fc8a-5eb6-46c1-a454-5fbc8e1c6492",
  "name": "offline_access",
  "description": "${role_offline-access}",
  "composite": false,
  "clientRole": false,
  "containerId": "4f0f8206-0ec4-4fd6-99eb-4e8c4b986c43"
}

] ```

func (*Client) RemoveOptionalClientScope added in v0.0.13

func (c *Client) RemoveOptionalClientScope(accessToken string, realmName, client, scope string) error

RemoveOptionalClientScope changes the optional client scopes for a realm to add the scope represented by scopeId DELETE /auth/admin/realms/demorealm/clients/0d55d933-09f4-427d-a385-13f5ceb1656e/optional-client-scopes/7efa02d9-0a1e-496d-abf7-d9edb80e47b3 HTTP/1.1 204

func (*Client) RemoveRealmDefaultClientScope added in v0.0.13

func (c *Client) RemoveRealmDefaultClientScope(accessToken string, realmName, scope string) error

RemoveRealmDefaultClientScope changes the default client scopes for a realm to add the scope represented by scopeId DELETE /auth/admin/realms/demorealm/default-default-client-scopes/2c683450-ae2d-48ef-ace3-bc9101b2c4d1 HTTP/1.1 204

func (*Client) RemoveRealmOptionalClientScope added in v0.0.13

func (c *Client) RemoveRealmOptionalClientScope(accessToken string, realmName, scope string) error

RemoveRealmOptionalClientScope changes the optional client scopes for a realm to add the scope represented by scopeId DELETE /auth/admin/realms/demorealm/default-optional-client-scopes/2c683450-ae2d-48ef-ace3-bc9101b2c4d1 HTTP/1.1 204

func (*Client) ResetPassword

func (c *Client) ResetPassword(accessToken string, realmName, userID string, cred CredentialRepresentation) error

ResetPassword resets password of the user.

func (*Client) SendNewEnrolmentCode

func (c *Client) SendNewEnrolmentCode(accessToken string, realmName string, userID string) (SmsCodeRepresentation, error)

SendNewEnrolmentCode sends a new enrolment code and return it

func (*Client) SendReminderEmail

func (c *Client) SendReminderEmail(accessToken string, realmName string, userID string, paramKV ...string) error

SendReminderEmail sends a reminder email to a user

func (*Client) SendVerifyEmail

func (c *Client) SendVerifyEmail(accessToken string, realmName string, userID string, paramKV ...string) error

SendVerifyEmail sends an email-verification email to the user An email contains a link the user can click to verify their email address.

func (*Client) UpdateAuthenticationExecution

func (c *Client) UpdateAuthenticationExecution(accessToken string, realmName, executionID string, authConfig AuthenticatorConfigRepresentation) error

UpdateAuthenticationExecution update execution with new configuration.

func (*Client) UpdateAuthenticationExecutionForFlow

func (c *Client) UpdateAuthenticationExecutionForFlow(accessToken string, realmName, flowAlias string, authExecInfo AuthenticationExecutionInfoRepresentation) error

UpdateAuthenticationExecutionForFlow updates the authentication executions of a flow.

func (*Client) UpdateAuthenticatorConfig

func (c *Client) UpdateAuthenticatorConfig(accessToken string, realmName, configID string, config AuthenticatorConfigRepresentation) error

UpdateAuthenticatorConfig updates the authenticator configuration.

func (*Client) UpdateClient added in v0.0.2

func (c *Client) UpdateClient(accessToken string, realmName, clientID string, client ClientRepresentation) error

UpdateClient updates the client.

func (*Client) UpdatePassword

func (c *Client) UpdatePassword(accessToken, realm, currentPassword, newPassword, confirmPassword string) (string, error)

UpdatePassword updates the user's password Parameters: realm, currentPassword, newPassword, confirmPassword

func (*Client) UpdateRealm

func (c *Client) UpdateRealm(accessToken string, realmName string, realm RealmRepresentation) error

UpdateRealm update the top lovel information of the realm. Any user, role or client information from the realm representation will be ignored.

func (*Client) UpdateRealmRoleByID added in v0.0.24

func (c *Client) UpdateRealmRoleByID(accessToken string, realmName string, roleId string, role RoleRepresentation) error

UpdateRealmRole updates a specific realm role’s representation PUT /auth/admin/realms/demorealm/roles-by-id/f19e86ad-ddf2-4397-9a36-63bf02119fe8

{
    "id": "f19e86ad-ddf2-4397-9a36-63bf02119fe8",
    "name": "offline_access",
    "description": "${role_offline-access}",
    "composite": false,
    "clientRole": false,
    "containerId": "b0b76f0e-3405-4d43-97da-4556d4cff122",
    "attributes": {}
}

func (*Client) UpdateRequiredAction

func (c *Client) UpdateRequiredAction(accessToken string, realmName, actionAlias string, action RequiredActionProviderRepresentation) error

UpdateRequiredAction updates the required action.

func (*Client) UpdateUser

func (c *Client) UpdateUser(accessToken string, realmName, userID string, user UserRepresentation) error

UpdateUser updates the user.

func (*Client) UpdateUserFederationProvider added in v0.0.7

func (c *Client) UpdateUserFederationProvider(accessToken string, realmName, userFederationProviderID string, userFederationProvider UserFederationProviderRepresentation) error

UpdateUserFederationProvider updates the UserFederationProvider.

func (*Client) UpdateUserFederationProviderMapper added in v0.0.7

func (c *Client) UpdateUserFederationProviderMapper(accessToken string, realmName, userFederationProviderMapperID string, userFederationProviderMapper UserFederationProviderMapperRepresentation) error

UpdateUserFederationProviderMapper updates the UserFederationProviderMapper.

func (*Client) UploadCertificate

func (c *Client) UploadCertificate(accessToken string, realmName, idClient, attr string, file []byte) (CertificateRepresentation, error)

UploadCertificate uploads only a certificate, not the private key.

func (*Client) UploadCertificatePrivateKey

func (c *Client) UploadCertificatePrivateKey(accessToken string, realmName, idClient, attr string, file []byte) (CertificateRepresentation, error)

UploadCertificatePrivateKey uploads a certificate and eventually a private key.

func (*Client) VerifyToken

func (c *Client) VerifyToken(realmName string, accessToken string) error

verifyToken token verify a token. It returns an error it is malformed, expired,...

type ClientCreateRequest added in v0.0.4

type ClientCreateRequest struct {
	Attributes   *map[string]interface{} `json:"attributes,omitempty"`
	ClientID     *string                 `json:"clientId,omitempty"`
	Enabled      *bool                   `json:"enabled,omitempty"`
	Protocol     *string                 `json:"protocol,omitempty"`
	RedirectURIs *[]string               `json:"redirectUris,omitempty"`
}

type ClientInitialAccessCreatePresentation

type ClientInitialAccessCreatePresentation struct {
	Count      *int32 `json:"count,omitempty"`
	Expiration *int32 `json:"expiration,omitempty"`
}

type ClientInitialAccessPresentation

type ClientInitialAccessPresentation struct {
	Count          *int32  `json:"count,omitempty"`
	Expiration     *int32  `json:"expiration,omitempty"`
	Id             *string `json:"id,omitempty"`
	RemainingCount *int32  `json:"remainingCount,omitempty"`
	Timestamp      *int32  `json:"timestamp,omitempty"`
	Token          *string `json:"token,omitempty"`
}

type ClientMappingsRepresentation

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

type ClientRepresentation

type ClientRepresentation struct {
	Access                             *map[string]interface{}         `json:"access,omitempty"`
	AdminUrl                           *string                         `json:"adminUrl,omitempty"`
	Attributes                         *map[string]interface{}         `json:"attributes,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"`
	ClientTemplate                     *string                         `json:"clientTemplate,omitempty"`
	ConsentRequired                    *bool                           `json:"consentRequired,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"`
	Protocol                           *string                         `json:"protocol,omitempty"`
	ProtocolMappers                    *[]ProtocolMapperRepresentation `json:"protocolMappers,omitempty"`
	PublicClient                       *bool                           `json:"publicClient,omitempty"`
	RedirectUris                       *[]string                       `json:"redirectUris,omitempty"`
	RegisteredNodes                    *map[string]interface{}         `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"`
	UseTemplateConfig                  *bool                           `json:"useTemplateConfig,omitempty"`
	UseTemplateMappers                 *bool                           `json:"useTemplateMappers,omitempty"`
	UseTemplateScope                   *bool                           `json:"useTemplateScope,omitempty"`
	WebOrigins                         *[]string                       `json:"webOrigins,omitempty"`
	AuthenticationFlowBindingOverrides *map[string]interface{}         `json:"authenticationFlowBindingOverrides,omitempty"`
}

type ClientScopeRepresentation added in v0.0.13

type ClientScopeRepresentation struct {
	Id              *string                         `json:"id,omitempty"`
	Name            *string                         `json:"name,omitempty"`
	Description     *string                         `json:"description,omitempty"`
	Protocol        *string                         `json:"protocol,omitempty"`
	ProtocolMappers *[]ProtocolMapperRepresentation `json:"protocolMappers,omitempty"`
	Attributes      *map[string][]string            `json:"attributes,omitempty"`
}

ClientScopeRepresentation wraps keycloak client scope data

type ClientTemplateRepresentation

type ClientTemplateRepresentation struct {
	Attributes                *map[string]interface{}         `json:"attributes,omitempty"`
	BearerOnly                *bool                           `json:"bearerOnly,omitempty"`
	ConsentRequired           *bool                           `json:"consentRequired,omitempty"`
	Description               *string                         `json:"description,omitempty"`
	DirectAccessGrantsEnabled *bool                           `json:"directAccessGrantsEnabled,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"`
	Protocol                  *string                         `json:"protocol,omitempty"`
	ProtocolMappers           *[]ProtocolMapperRepresentation `json:"protocolMappers,omitempty"`
	PublicClient              *bool                           `json:"publicClient,omitempty"`
	ServiceAccountsEnabled    *bool                           `json:"serviceAccountsEnabled,omitempty"`
	StandardFlowEnabled       *bool                           `json:"standardFlowEnabled,omitempty"`
}

type ComponentExportRepresentation

type ComponentExportRepresentation struct {
	Config        *MultivaluedHashMap `json:"config,omitempty"`
	Id            *string             `json:"id,omitempty"`
	Name          *string             `json:"name,omitempty"`
	ProviderId    *string             `json:"providerId,omitempty"`
	SubComponents *MultivaluedHashMap `json:"subComponents,omitempty"`
	SubType       *string             `json:"subType,omitempty"`
}

type ComponentRepresentation

type ComponentRepresentation struct {
	Config       *MultivaluedHashMap `json:"config,omitempty"`
	Id           *string             `json:"id,omitempty"`
	Name         *string             `json:"name,omitempty"`
	ParentId     *string             `json:"parentId,omitempty"`
	ProviderId   *string             `json:"providerId,omitempty"`
	ProviderType *string             `json:"providerType,omitempty"`
	SubType      *string             `json:"subType,omitempty"`
}

type ComponentTypeRepresentation

type ComponentTypeRepresentation struct {
	HelpText   *string                         `json:"helpText,omitempty"`
	Id         *string                         `json:"id,omitempty"`
	Metadata   *map[string]interface{}         `json:"metadata,omitempty"`
	Properties *[]ConfigPropertyRepresentation `json:"properties,omitempty"`
}

type Config

type Config struct {
	AddrTokenProvider string
	AddrAPI           string
	Timeout           time.Duration
}

Config is the keycloak client http config.

type ConfigPropertyRepresentation

type ConfigPropertyRepresentation struct {
	DefaultValue *map[string]interface{} `json:"defaultValue,omitempty"`
	HelpText     *string                 `json:"helpText,omitempty"`
	Label        *string                 `json:"label,omitempty"`
	Name         *string                 `json:"name,omitempty"`
	Options      *[]string               `json:"options,omitempty"`
	Secret       *bool                   `json:"secret,omitempty"`
	Type         *string                 `json:"type,omitempty"`
}

type CredentialRepresentation

type CredentialRepresentation struct {
	Id                *string              `json:"id,omitempty"`
	Algorithm         *string              `json:"algorithm,omitempty"`
	Config            *map[string][]string `json:"config,omitempty"`
	Counter           *int32               `json:"counter,omitempty"`
	CreatedDate       *int64               `json:"createdDate,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"`
	Temporary         *bool                `json:"temporary,omitempty"`
	Type              *string              `json:"type,omitempty"`
	Value             *string              `json:"value,omitempty"`
}

type EventRepresentation

type EventRepresentation struct {
	ClientId  *string                 `json:"clientId,omitempty"`
	Details   *map[string]interface{} `json:"details,omitempty"`
	Error     *string                 `json:"error,omitempty"`
	IpAddress *string                 `json:"ipAddress,omitempty"`
	RealmId   *string                 `json:"realmId,omitempty"`
	SessionId *string                 `json:"sessionId,omitempty"`
	Time      *int64                  `json:"time,omitempty"`
	Type      *string                 `json:"type,omitempty"`
	UserId    *string                 `json:"userId,omitempty"`
}

type FederatedIdentityRepresentation

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

type GlobalRequestResult

type GlobalRequestResult struct {
	FailedRequests  *[]string `json:"failedRequests,omitempty"`
	SuccessRequests *[]string `json:"successRequests,omitempty"`
}

type GroupRepresentation

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

type HTTPError

type HTTPError struct {
	HTTPStatus int
	Message    string
}

HTTPError is returned when an error occurred while contacting the keycloak instance.

func (HTTPError) Error

func (e HTTPError) Error() string

type IdentityProviderMapperRepresentation

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

type IdentityProviderRepresentation

type IdentityProviderRepresentation struct {
	AddReadTokenRoleOnCreate  *bool                   `json:"addReadTokenRoleOnCreate,omitempty"`
	Alias                     *string                 `json:"alias,omitempty"`
	Config                    *map[string]interface{} `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"`
}

type InitiatePKCELogin added in v0.0.22

type InitiatePKCELogin struct {
	Nonce               string `schema:"nonce"`
	ClientID            string `schema:"client_id"`
	ResponseType        string `schema:"response_type"`
	Scope               string `schema:"scope"`
	RedirectURI         string `schema:"redirect_uri"`
	ResponseMode        string `schema:"response_mode"`
	State               string `schema:"state"`
	Username            string `schema:"username"`
	Target              string `schema:"target"`
	AuthSessionID       string `schema:"auth_session_id"`
	CodeChallenge       string `schema:"code_challenge"`
	CodeChallengeMethod string `schema:"code_challenge_method"`
}

type KeyStoreConfig

type KeyStoreConfig struct {
	Format           *string `json:"format,omitempty"`
	KeyAlias         *string `json:"keyAlias,omitempty"`
	KeyPassword      *string `json:"keyPassword,omitempty"`
	RealmAlias       *string `json:"realmAlias,omitempty"`
	RealmCertificate *bool   `json:"realmCertificate,omitempty"`
	StorePassword    *string `json:"storePassword,omitempty"`
}

type KeysMetadataRepresentation

type KeysMetadataRepresentation struct {
	Active *map[string]interface{}                                `json:"active,omitempty"`
	Keys   *[]KeysMetadataRepresentationKeyMetadataRepresentation `json:"keys,omitempty"`
}

type KeysMetadataRepresentationKeyMetadataRepresentation

type KeysMetadataRepresentationKeyMetadataRepresentation struct {
	Certificate      *string `json:"certificate,omitempty"`
	Kid              *string `json:"kid,omitempty"`
	ProviderId       *string `json:"providerId,omitempty"`
	ProviderPriority *int64  `json:"providerPriority,omitempty"`
	PublicKey        *string `json:"publicKey,omitempty"`
	Status           *string `json:"status,omitempty"`
	Type             *string `json:"type,omitempty"`
}

type ManagementPermissionReference

type ManagementPermissionReference struct {
	Enabled          *bool                   `json:"enabled,omitempty"`
	Resource         *string                 `json:"resource,omitempty"`
	ScopePermissions *map[string]interface{} `json:"scopePermissions,omitempty"`
}

type MappingsRepresentation

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

type MemoryInfoRepresentation

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

type MultivaluedHashMap

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

type PartialImportRepresentation

type PartialImportRepresentation struct {
	Clients           *[]ClientRepresentation           `json:"clients,omitempty"`
	Groups            *[]GroupRepresentation            `json:"groups,omitempty"`
	IdentityProviders *[]IdentityProviderRepresentation `json:"identityProviders,omitempty"`
	IfResourceExists  *string                           `json:"ifResourceExists,omitempty"`
	Policy            *string                           `json:"policy,omitempty"`
	Roles             *RolesRepresentation              `json:"roles,omitempty"`
	Users             *[]UserRepresentation             `json:"users,omitempty"`
}

type PasswordPolicyTypeRepresentation

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

type PolicyRepresentation

type PolicyRepresentation struct {
	Config           *map[string]interface{} `json:"config,omitempty"`
	DecisionStrategy *string                 `json:"decisionStrategy,omitempty"`
	Description      *string                 `json:"description,omitempty"`
	Id               *string                 `json:"id,omitempty"`
	Logic            *string                 `json:"logic,omitempty"`
	Name             *string                 `json:"name,omitempty"`
	Policies         *[]string               `json:"policies,omitempty"`
	Resources        *[]string               `json:"resources,omitempty"`
	Scopes           *[]string               `json:"scopes,omitempty"`
	Type             *string                 `json:"type,omitempty"`
}

type ProfileInfoRepresentation

type ProfileInfoRepresentation struct {
	DisabledFeatures *[]string `json:"disabledFeatures,omitempty"`
	Name             *string   `json:"name,omitempty"`
}

type ProtocolMapperRepresentation

type ProtocolMapperRepresentation struct {
	Config          *map[string]interface{} `json:"config,omitempty"`
	ConsentRequired *bool                   `json:"consentRequired,omitempty"`
	ConsentText     *string                 `json:"consentText,omitempty"`
	Id              *string                 `json:"id,omitempty"`
	Name            *string                 `json:"name,omitempty"`
	Protocol        *string                 `json:"protocol,omitempty"`
	ProtocolMapper  *string                 `json:"protocolMapper,omitempty"`
}

type ProviderRepresentation

type ProviderRepresentation struct {
	OperationalInfo *map[string]interface{} `json:"operationalInfo,omitempty"`
	Order           *int32                  `json:"order,omitempty"`
}

type RealmEventsConfigRepresentation

type RealmEventsConfigRepresentation struct {
	AdminEventsDetailsEnabled *bool     `json:"adminEventsDetailsEnabled,omitempty"`
	AdminEventsEnabled        *bool     `json:"adminEventsEnabled,omitempty"`
	EnabledEventTypes         *[]string `json:"enabledEventTypes,omitempty"`
	EventsEnabled             *bool     `json:"eventsEnabled,omitempty"`
	EventsExpiration          *int64    `json:"eventsExpiration,omitempty"`
	EventsListeners           *[]string `json:"eventsListeners,omitempty"`
}

type RealmRepresentation

type RealmRepresentation struct {
	AccessCodeLifespan                  *int32                                  `json:"accessCodeLifespan,omitempty"`
	AccessCodeLifespanLogin             *int32                                  `json:"accessCodeLifespanLogin,omitempty"`
	AccessCodeLifespanUserAction        *int32                                  `json:"accessCodeLifespanUserAction,omitempty"`
	AccessTokenLifespan                 *int32                                  `json:"accessTokenLifespan,omitempty"`
	AccessTokenLifespanForImplicitFlow  *int32                                  `json:"accessTokenLifespanForImplicitFlow,omitempty"`
	AccountTheme                        *string                                 `json:"accountTheme,omitempty"`
	ActionTokenGeneratedByAdminLifespan *int32                                  `json:"actionTokenGeneratedByAdminLifespan,omitempty"`
	ActionTokenGeneratedByUserLifespan  *int32                                  `json:"actionTokenGeneratedByUserLifespan,omitempty"`
	AdminEventsDetailsEnabled           *bool                                   `json:"adminEventsDetailsEnabled,omitempty"`
	AdminEventsEnabled                  *bool                                   `json:"adminEventsEnabled,omitempty"`
	AdminTheme                          *string                                 `json:"adminTheme,omitempty"`
	Attributes                          *map[string]interface{}                 `json:"attributes,omitempty"`
	AuthenticationFlows                 *[]AuthenticationFlowRepresentation     `json:"authenticationFlows,omitempty"`
	AuthenticatorConfig                 *[]AuthenticatorConfigRepresentation    `json:"authenticatorConfig,omitempty"`
	BrowserFlow                         *string                                 `json:"browserFlow,omitempty"`
	BrowserSecurityHeaders              *map[string]interface{}                 `json:"browserSecurityHeaders,omitempty"`
	BruteForceProtected                 *bool                                   `json:"bruteForceProtected,omitempty"`
	ClientAuthenticationFlow            *string                                 `json:"clientAuthenticationFlow,omitempty"`
	ClientScopeMappings                 *map[string]interface{}                 `json:"clientScopeMappings,omitempty"`
	ClientTemplates                     *[]ClientTemplateRepresentation         `json:"clientTemplates,omitempty"`
	Clients                             *[]ClientRepresentation                 `json:"clients,omitempty"`
	Components                          *MultivaluedHashMap                     `json:"components,omitempty"`
	DefaultGroups                       *[]string                               `json:"defaultGroups,omitempty"`
	DefaultLocale                       *string                                 `json:"defaultLocale,omitempty"`
	DefaultRoles                        *[]string                               `json:"defaultRoles,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                       *int32                                  `json:"failureFactor,omitempty"`
	FederatedUsers                      *[]UserRepresentation                   `json:"federatedUsers,omitempty"`
	Groups                              *[]GroupRepresentation                  `json:"groups,omitempty"`
	Id                                  *string                                 `json:"id,omitempty"`
	IdentityProviderMappers             *[]IdentityProviderMapperRepresentation `json:"identityProviderMappers,omitempty"`
	IdentityProviders                   *[]IdentityProviderRepresentation       `json:"identityProviders,omitempty"`
	InternationalizationEnabled         *bool                                   `json:"internationalizationEnabled,omitempty"`
	KeycloakVersion                     *string                                 `json:"keycloakVersion,omitempty"`
	LoginTheme                          *string                                 `json:"loginTheme,omitempty"`
	LoginWithEmailAllowed               *bool                                   `json:"loginWithEmailAllowed,omitempty"`
	MaxDeltaTimeSeconds                 *int32                                  `json:"maxDeltaTimeSeconds,omitempty"`
	MaxFailureWaitSeconds               *int32                                  `json:"maxFailureWaitSeconds,omitempty"`
	MinimumQuickLoginWaitSeconds        *int32                                  `json:"minimumQuickLoginWaitSeconds,omitempty"`
	NotBefore                           *int32                                  `json:"notBefore,omitempty"`
	OfflineSessionIdleTimeout           *int32                                  `json:"offlineSessionIdleTimeout,omitempty"`
	OtpPolicyAlgorithm                  *string                                 `json:"otpPolicyAlgorithm,omitempty"`
	OtpPolicyDigits                     *int32                                  `json:"otpPolicyDigits,omitempty"`
	OtpPolicyInitialCounter             *int32                                  `json:"otpPolicyInitialCounter,omitempty"`
	OtpPolicyLookAheadWindow            *int32                                  `json:"otpPolicyLookAheadWindow,omitempty"`
	OtpPolicyPeriod                     *int32                                  `json:"otpPolicyPeriod,omitempty"`
	OtpPolicyType                       *string                                 `json:"otpPolicyType,omitempty"`
	OtpSupportedApplications            *[]string                               `json:"otpSupportedApplications,omitempty"`
	PasswordPolicy                      *string                                 `json:"passwordPolicy,omitempty"`
	PermanentLockout                    *bool                                   `json:"permanentLockout,omitempty"`
	ProtocolMappers                     *[]ProtocolMapperRepresentation         `json:"protocolMappers,omitempty"`
	QuickLoginCheckMilliSeconds         *int64                                  `json:"quickLoginCheckMilliSeconds,omitempty"`
	Realm                               *string                                 `json:"realm,omitempty"`
	RefreshTokenMaxReuse                *int32                                  `json:"refreshTokenMaxReuse,omitempty"`
	RegistrationAllowed                 *bool                                   `json:"registrationAllowed,omitempty"`
	RegistrationEmailAsUsername         *bool                                   `json:"registrationEmailAsUsername,omitempty"`
	RegistrationFlow                    *string                                 `json:"registrationFlow,omitempty"`
	RememberMe                          *bool                                   `json:"rememberMe,omitempty"`
	RequiredActions                     *[]RequiredActionProviderRepresentation `json:"requiredActions,omitempty"`
	ResetCredentialsFlow                *string                                 `json:"resetCredentialsFlow,omitempty"`
	ResetPasswordAllowed                *bool                                   `json:"resetPasswordAllowed,omitempty"`
	RevokeRefreshToken                  *bool                                   `json:"revokeRefreshToken,omitempty"`
	Roles                               *RolesRepresentation                    `json:"roles,omitempty"`
	ScopeMappings                       *[]ScopeMappingRepresentation           `json:"scopeMappings,omitempty"`
	SmtpServer                          *map[string]interface{}                 `json:"smtpServer,omitempty"`
	SslRequired                         *string                                 `json:"sslRequired,omitempty"`
	SSOSessionIdleTimeout               *int32                                  `json:"ssoSessionIdleTimeout,omitempty"`
	SSOSessionMaxLifespan               *int32                                  `json:"ssoSessionMaxLifespan,omitempty"`
	SupportedLocales                    *[]string                               `json:"supportedLocales,omitempty"`
	Users                               *[]UserRepresentation                   `json:"users,omitempty"`
	VerifyEmail                         *bool                                   `json:"verifyEmail,omitempty"`
	WaitIncrementSeconds                *int32                                  `json:"waitIncrementSeconds,omitempty"`
}

type RequestLogger added in v0.0.17

type RequestLogger interface {
	Debugf(string, ...interface{})
}

RequestLogger wraps indicates a logger with a Debugf method

type RequiredActionProviderRepresentation

type RequiredActionProviderRepresentation struct {
	Alias         *string                 `json:"alias,omitempty"`
	Config        *map[string]interface{} `json:"config,omitempty"`
	DefaultAction *bool                   `json:"defaultAction,omitempty"`
	Enabled       *bool                   `json:"enabled,omitempty"`
	Name          *string                 `json:"name,omitempty"`
	ProviderId    *string                 `json:"providerId,omitempty"`
	Priority      *int                    `json:"priority,omitempty"`
}

type ResourceOwnerRepresentation

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

type ResourceRepresentation

type ResourceRepresentation struct {
	Id          *string                      `json:"id,omitempty"`
	Icon_uri    *string                      `json:"icon_uri,omitempty"`
	Name        *string                      `json:"name,omitempty"`
	Owner       *ResourceOwnerRepresentation `json:"owner,omitempty"`
	Policies    *[]PolicyRepresentation      `json:"policies,omitempty"`
	Scopes      *[]ScopeRepresentation       `json:"scopes,omitempty"`
	Type        *string                      `json:"type,omitempty"`
	TypedScopes *[]ScopeRepresentation       `json:"typedScopes,omitempty"`
	Uri         *string                      `json:"uri,omitempty"`
}

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         *string                   `json:"policyEnforcementMode,omitempty"`
	Resources                     *[]ResourceRepresentation `json:"resources,omitempty"`
	Scopes                        *[]ScopeRepresentation    `json:"scopes,omitempty"`
}

type RoleRepresentation

type RoleRepresentation struct {
	ClientRole         *bool                         `json:"clientRole,omitempty"`
	Composite          *bool                         `json:"composite,omitempty"`
	Composites         *RoleRepresentationComposites `json:"composites,omitempty"`
	ContainerId        *string                       `json:"containerId,omitempty"`
	Description        *string                       `json:"description,omitempty"`
	Id                 *string                       `json:"id,omitempty"`
	Name               *string                       `json:"name,omitempty"`
	ScopeParamRequired *bool                         `json:"scopeParamRequired,omitempty"`
}

type RoleRepresentationComposites

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

type RolesRepresentation

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

type ScopeMappingRepresentation

type ScopeMappingRepresentation struct {
	Client         *string   `json:"client,omitempty"`
	ClientTemplate *string   `json:"clientTemplate,omitempty"`
	Roles          *[]string `json:"roles,omitempty"`
	Self           *string   `json:"self,omitempty"`
}

type ScopeRepresentation

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

type ServerInfoRepresentation

type ServerInfoRepresentation struct {
	BuiltinProtocolMappers *map[string]interface{}             `json:"builtinProtocolMappers,omitempty"`
	ClientImporters        *[]map[string]interface{}           `json:"clientImporters,omitempty"`
	ClientInstallations    *map[string]interface{}             `json:"clientInstallations,omitempty"`
	ComponentTypes         *map[string]interface{}             `json:"componentTypes,omitempty"`
	Enums                  *map[string]interface{}             `json:"enums,omitempty"`
	IdentityProviders      *[]map[string]interface{}           `json:"identityProviders,omitempty"`
	MemoryInfo             *MemoryInfoRepresentation           `json:"memoryInfo,omitempty"`
	PasswordPolicies       *[]PasswordPolicyTypeRepresentation `json:"passwordPolicies,omitempty"`
	ProfileInfo            *ProfileInfoRepresentation          `json:"profileInfo,omitempty"`
	ProtocolMapperTypes    *map[string]interface{}             `json:"protocolMapperTypes,omitempty"`
	Providers              *map[string]interface{}             `json:"providers,omitempty"`
	SocialProviders        *[]map[string]interface{}           `json:"socialProviders,omitempty"`
	SystemInfo             *SystemInfoRepresentation           `json:"systemInfo,omitempty"`
	Themes                 *map[string]interface{}             `json:"themes,omitempty"`
}

type SmsCodeRepresentation

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

type SpiInfoRepresentation

type SpiInfoRepresentation struct {
	Internal  *bool                   `json:"internal,omitempty"`
	Providers *map[string]interface{} `json:"providers,omitempty"`
}

type SynchronizationResult

type SynchronizationResult struct {
	Added   *int32  `json:"added,omitempty"`
	Failed  *int32  `json:"failed,omitempty"`
	Ignored *bool   `json:"ignored,omitempty"`
	Removed *int32  `json:"removed,omitempty"`
	Status  *string `json:"status,omitempty"`
	Updated *int32  `json:"updated,omitempty"`
}

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   *int64  `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"`
}

type Token

type Token struct {
	Issuer         string `json:"iss,omitempty"`
	Subject        string `json:"sub,omitempty"`
	ExpirationTime int64  `json:"exp,omitempty"`
	NotBefore      int64  `json:"nbf,omitempty"`
	IssuedAt       int64  `json:"iat,omitempty"`
	ID             string `json:"jti,omitempty"`
	Username       string `json:"preferred_username,omitempty"`
	// contains filtered or unexported fields
}

Token is JWT token. We need to define our own structure as the library define aud as a string but it can also be a string array. To fix this issue, we remove aud as we do not use it here.

type TokenInfo added in v0.0.15

type TokenInfo struct {
	TokenType      string
	AccessToken    string
	Expires        time.Time
	RefreshToken   string
	RefreshExpires time.Time
	// contains filtered or unexported fields
}

TokenInfo represents a full oAuth2 JWT token response with expiration and refresh

type UserConsentRepresentation

type UserConsentRepresentation struct {
	ClientId               *string                 `json:"clientId,omitempty"`
	CreatedDate            *int64                  `json:"createdDate,omitempty"`
	GrantedClientRoles     *map[string]interface{} `json:"grantedClientRoles,omitempty"`
	GrantedProtocolMappers *map[string]interface{} `json:"grantedProtocolMappers,omitempty"`
	GrantedRealmRoles      *[]string               `json:"grantedRealmRoles,omitempty"`
	LastUpdatedDate        *int64                  `json:"lastUpdatedDate,omitempty"`
}

type UserDetailsRepresentation added in v0.0.8

type UserDetailsRepresentation struct {
	ID             *string                 `json:"id,omitempty"`
	Username       *string                 `json:"username,omitempty"`
	FirstName      *string                 `json:"firstName,omitempty"`
	LastName       *string                 `json:"lastName,omitempty"`
	Email          *string                 `json:"email,omitempty"`
	Enabled        *bool                   `json:"enabled,omitempty"`
	FederationLink *string                 `json:"federationLink,omitempty"`
	Roles          *MappingsRepresentation `json:"roles,omitempty"`
	Groups         *[]GroupRepresentation  `json:"groups,omitempty"`
	Attributes     *map[string][]string    `json:"attributes,omitempty"`
}

type UserFederationProviderMapperRepresentation added in v0.0.7

type UserFederationProviderMapperRepresentation = UserFederationProviderRepresentation

type UserFederationProviderRepresentation

type UserFederationProviderRepresentation struct {
	Id          *string `json:"id,omitempty"`
	DisplayName *string `json:"name,omitempty"`
	// The id of the resource the provider is attached to
	// will be realm id for a user federation provider or
	// provider id for a user federation provider mapper
	ParentId *string `json:"parentId,omitempty"`
	// User viewable type of the provider
	ProviderId *string `json:"providerId,omitempty"`
	// Keycloak defined type corresponding to the ProviderId
	ProviderType *string              `json:"providerType,omitempty"`
	Config       *map[string][]string `json:"config,omitempty"`
}

type UserRepresentation

type UserRepresentation struct {
	Access                     *map[string]bool                   `json:"access,omitempty"`
	Attributes                 *map[string][]string               `json:"attributes,omitempty"`
	ClientConsents             *[]UserConsentRepresentation       `json:"clientConsents,omitempty"`
	ClientRoles                *map[string][]string               `json:"clientRoles,omitempty"`
	CreatedTimestamp           *int64                             `json:"createdTimestamp,omitempty"`
	Credentials                *[]CredentialRepresentation        `json:"credentials,omitempty"`
	DisableableCredentialTypes *[]string                          `json:"disableableCredentialTypes,omitempty"`
	Email                      *string                            `json:"email,omitempty"`
	EmailVerified              *bool                              `json:"emailVerified,omitempty"`
	Enabled                    *bool                              `json:"enabled,omitempty"`
	FederatedIdentities        *[]FederatedIdentityRepresentation `json:"federatedIdentities,omitempty"`
	FederationLink             *string                            `json:"federationLink,omitempty"`
	FirstName                  *string                            `json:"firstName,omitempty"`
	Groups                     *[]string                          `json:"groups,omitempty"`
	Id                         *string                            `json:"id,omitempty"`
	LastName                   *string                            `json:"lastName,omitempty"`
	NotBefore                  *int32                             `json:"notBefore,omitempty"`
	Origin                     *string                            `json:"origin,omitempty"`
	RealmRoles                 *[]string                          `json:"realmRoles,omitempty"`
	RequiredActions            *[]string                          `json:"requiredActions,omitempty"`
	Self                       *string                            `json:"self,omitempty"`
	ServiceAccountClientId     *string                            `json:"serviceAccountClientId,omitempty"`
	Username                   *string                            `json:"username,omitempty"`
}

type UserSessionRepresentation

type UserSessionRepresentation struct {
	Clients    *map[string]interface{} `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"`
}

type Users added in v0.0.3

type Users []UserRepresentation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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