Documentation ¶
Index ¶
- type Client
- type ClientSecret
- type Group
- type KeycloakClient
- func (c *KeycloakClient) AddRoleMapping(rm RoleMapping) error
- func (c *KeycloakClient) CreateClient(client *Client, realm string) (*Client, error)
- func (c *KeycloakClient) CreateClientRole(role *Role, realm, clientId string) (*Role, error)
- func (c *KeycloakClient) CreateProtocolMapper(pm *ProtocolMapper, realm, clientId string) (*ProtocolMapper, error)
- func (c *KeycloakClient) CreateRealm(r *Realm) (*Realm, error)
- func (c *KeycloakClient) CreateRealmRole(role *Role, realm string) (*Role, error)
- func (c *KeycloakClient) DeleteClient(id string, realm string) error
- func (c *KeycloakClient) DeleteProtocolMapper(id, realm, clientId string) error
- func (c *KeycloakClient) DeleteRealm(id string) error
- func (c *KeycloakClient) DeleteRole(id, realm string) error
- func (c *KeycloakClient) DeleteRoleMapping(rm RoleMapping) error
- func (c *KeycloakClient) GetAvailableRoles(rm RoleMapping) ([]Role, error)
- func (c *KeycloakClient) GetClient(id string, realm string) (*Client, error)
- func (c *KeycloakClient) GetClientInstallationSamlDesc(id, realm string) (string, error)
- func (c *KeycloakClient) GetClientSecret(id string, realm string) (*ClientSecret, error)
- func (c *KeycloakClient) GetClientServiceAccountUser(id, realm string) (*User, error)
- func (c *KeycloakClient) GetCompositeRoles(rm RoleMapping) ([]Role, error)
- func (c *KeycloakClient) GetGroupByName(name, realm string) (*Group, error)
- func (c *KeycloakClient) GetProtocolMapper(id, realm, clientId string) (*ProtocolMapper, error)
- func (c *KeycloakClient) GetRealm(id string) (*Realm, error)
- func (c *KeycloakClient) GetRole(id, realm string) (*Role, error)
- func (c *KeycloakClient) GetUserByName(name, realm string) (*User, error)
- func (c *KeycloakClient) ListClients(realm string) ([]*Client, error)
- func (c *KeycloakClient) ListProtocolMappers(realm, clientId string) (*[]ProtocolMapper, error)
- func (c *KeycloakClient) Login() error
- func (c *KeycloakClient) UpdateClient(client *Client, realm string) error
- func (c *KeycloakClient) UpdateProtocolMapper(pm *ProtocolMapper, realm, clientId string) error
- func (c *KeycloakClient) UpdateRealm(r *Realm) error
- func (c *KeycloakClient) UpdateRole(role *Role, realm string) error
- type ProtocolMapper
- type Realm
- type Role
- type RoleMapping
- type SmtpServer
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Id string `json:"id,omitempty"` ClientId string `json:"clientId"` Enabled bool `json:"enabled"` ClientAuthenticatorType string `json:"clientAuthenticatorType,omitempty"` RedirectUris []string `json:"redirectUris"` RootUrl string `json:"rootUrl"` AdminUrl string `json:"adminUrl"` BaseUrl string `json:"baseUrl"` Protocol string `json:"protocol,omitempty"` PublicClient bool `json:"publicClient"` BearerOnly bool `json:"bearerOnly"` ServiceAccountsEnabled bool `json:"serviceAccountsEnabled"` DirectAccessGrantsEnabled bool `json:"directAccessGrantsEnabled"` ImplicitFlowEnabled bool `json:"implicitFlowEnabled"` StandardFlowEnabled bool `json:"standardFlowEnabled"` WebOrigins []string `json:"webOrigins"` FullScopeAllowed bool `json:"fullScopeAllowed"` Attributes map[string]interface{} `json:"attributes,omitempty"` }
type ClientSecret ¶
type KeycloakClient ¶
type KeycloakClient struct {
// contains filtered or unexported fields
}
An authenticated Keycloak API client
func NewKeycloakClient ¶
func NewKeycloakClient(id, secret, baseUrl, realm string) *KeycloakClient
func (*KeycloakClient) AddRoleMapping ¶
func (c *KeycloakClient) AddRoleMapping(rm RoleMapping) error
func (*KeycloakClient) CreateClient ¶
func (c *KeycloakClient) CreateClient(client *Client, realm string) (*Client, error)
Attempt to create a Keycloak client and return the created client.
func (*KeycloakClient) CreateClientRole ¶
func (c *KeycloakClient) CreateClientRole(role *Role, realm, clientId string) (*Role, error)
func (*KeycloakClient) CreateProtocolMapper ¶
func (c *KeycloakClient) CreateProtocolMapper(pm *ProtocolMapper, realm, clientId string) (*ProtocolMapper, error)
func (*KeycloakClient) CreateRealm ¶
func (c *KeycloakClient) CreateRealm(r *Realm) (*Realm, error)
This "imports" (i.e. creates) a realm from a realm representation.
func (*KeycloakClient) CreateRealmRole ¶
func (c *KeycloakClient) CreateRealmRole(role *Role, realm string) (*Role, error)
func (*KeycloakClient) DeleteClient ¶
func (c *KeycloakClient) DeleteClient(id string, realm string) error
func (*KeycloakClient) DeleteProtocolMapper ¶
func (c *KeycloakClient) DeleteProtocolMapper(id, realm, clientId string) error
func (*KeycloakClient) DeleteRealm ¶
func (c *KeycloakClient) DeleteRealm(id string) error
func (*KeycloakClient) DeleteRole ¶
func (c *KeycloakClient) DeleteRole(id, realm string) error
func (*KeycloakClient) DeleteRoleMapping ¶
func (c *KeycloakClient) DeleteRoleMapping(rm RoleMapping) error
func (*KeycloakClient) GetAvailableRoles ¶
func (c *KeycloakClient) GetAvailableRoles(rm RoleMapping) ([]Role, error)
* API client methods *
func (*KeycloakClient) GetClient ¶
func (c *KeycloakClient) GetClient(id string, realm string) (*Client, error)
func (*KeycloakClient) GetClientInstallationSamlDesc ¶
func (c *KeycloakClient) GetClientInstallationSamlDesc(id, realm string) (string, error)
func (*KeycloakClient) GetClientSecret ¶
func (c *KeycloakClient) GetClientSecret(id string, realm string) (*ClientSecret, error)
func (*KeycloakClient) GetClientServiceAccountUser ¶
func (c *KeycloakClient) GetClientServiceAccountUser(id, realm string) (*User, error)
func (*KeycloakClient) GetCompositeRoles ¶
func (c *KeycloakClient) GetCompositeRoles(rm RoleMapping) ([]Role, error)
func (*KeycloakClient) GetGroupByName ¶
func (c *KeycloakClient) GetGroupByName(name, realm string) (*Group, error)
func (*KeycloakClient) GetProtocolMapper ¶
func (c *KeycloakClient) GetProtocolMapper(id, realm, clientId string) (*ProtocolMapper, error)
func (*KeycloakClient) GetUserByName ¶
func (c *KeycloakClient) GetUserByName(name, realm string) (*User, error)
func (*KeycloakClient) ListClients ¶
func (c *KeycloakClient) ListClients(realm string) ([]*Client, error)
func (*KeycloakClient) ListProtocolMappers ¶
func (c *KeycloakClient) ListProtocolMappers(realm, clientId string) (*[]ProtocolMapper, error)
func (*KeycloakClient) Login ¶
func (c *KeycloakClient) Login() error
Attempt to login to Keycloak with the provided information.
func (*KeycloakClient) UpdateClient ¶
func (c *KeycloakClient) UpdateClient(client *Client, realm string) error
func (*KeycloakClient) UpdateProtocolMapper ¶
func (c *KeycloakClient) UpdateProtocolMapper(pm *ProtocolMapper, realm, clientId string) error
func (*KeycloakClient) UpdateRealm ¶
func (c *KeycloakClient) UpdateRealm(r *Realm) error
func (*KeycloakClient) UpdateRole ¶
func (c *KeycloakClient) UpdateRole(role *Role, realm string) error
type ProtocolMapper ¶
type ProtocolMapper struct { Id string `json:"id,omitempty"` Name string `json:"name"` Protocol string `json:"protocol,omitempty"` ProtocolMapper string `json:"protocolMapper,omitempty"` ConsentRequired bool `json:"consentRequired,omitempty"` ConsentText string `json:"consentText,omitempty"` Config map[string]interface{} `json:"config,omitempty"` }
type Realm ¶
type Realm struct { // General realm settings Id string `json:"id"` Realm string `json:"realm"` Enabled bool `json:"enabled"` // Optional realm settings SslRequired string `json:"sslRequired,omitempty"` // valid values are ALL, NONE or EXTERNAL DisplayName string `json:"displayName,omitempty"` SupportedLocales []string `json:"supportedLocales,omitempty"` DefaultRoles []string `json:"defaultRoles,omitempty"` SmtpServer *SmtpServer `json:"smtpServer,omitempty"` AccountTheme string `json:"accountTheme,omitempty"` AdminTheme string `json:"adminTheme,omitempty"` EmailTheme string `json:"emailTheme,omitempty"` LoginTheme string `json:"loginTheme,omitempty"` InternationalizationEnabled *bool `json:"internationalizationEnabled,omitempty"` RegistrationAllowed *bool `json:"registrationAllowed,omitempty"` RegistrationEmailAsUsername *bool `json:"registrationEmailAsUsername,omitempty"` RememberMe *bool `json:"rememberMe,omitempty"` VerifyEmail *bool `json:"verifyEmail,omitempty"` ResetPasswordAllowed *bool `json:"resetPasswordAllowed,omitempty"` EditUsernameAllowed *bool `json:"editUsernameAllowed,omitempty"` BruteForceProtected *bool `json:"bruteForceProtected,omitempty"` // Token & session settings AccessTokenLifespan *int `json:"accessTokenLifespan,omitempty"` AccessTokenLifespanForImplicitFlow *int `json:"accessTokenLifespanForImplicitFlow,omitempty"` SsoSessionIdleTimeout *int `json:"ssoSessionIdleTimeout,omitempty"` SsoSessionMaxLifespan *int `json:"ssoSessionMaxLifespan,omitempty"` OfflineSessionIdleTimeout *int `json:"offlineSessionIdleTimeout,omitempty"` AccessCodeLifespan *int `json:"accessCodeLifespan,omitempty"` AccessCodeLifespanUserAction *int `json:"accessCodeLifespanUserAction,omitempty"` AccessCodeLifespanLogin *int `json:"accessCodeLifespanLogin,omitempty"` MaxFailureWaitSeconds *int `json:"maxFailureWaitSeconds,omitempty"` MinimumQuickLoginWaitSeconds *int `json:"minimumQuickLoginWaitSeconds,omitempty"` WaitIncrementSeconds *int `json:"waitIncrementSeconds,omitempty"` QuickLoginCheckMilliSeconds *int `json:"quickLoginCheckMilliSeconds,omitempty"` MaxDeltaTimeSeconds *int `json:"maxDeltaTimeSeconds,omitempty"` FailureFactor *int `json:"failureFactor,omitempty"` }
Representation of top-level realm keys. According to the Keycloak documentation other keys than top-level keys will be ignored on realm updates, which is why they are not included here. http://www.keycloak.org/docs-api/3.1/rest-api/index.html#_realmrepresentation
type Role ¶
type Role struct { Id string `json:"id,omitempty"` Name string `json:"name"` ClientRole bool `json:"clientRole,omitempty"` ContainerId string `json:"containerId,omitempty"` Description string `json:"description,omitempty"` ScopeParamRequired bool `json:"scopeParamRequired,omitempty"` }
Does not implement composite roles at this timej
type RoleMapping ¶
type RoleMapping struct { Realm string RoleId string UserName string GroupName string UserId string GroupId string ClientId string // contains filtered or unexported fields }
Not a real object in keycloak, just convenient
func DeserializeRoleMapping ¶
func DeserializeRoleMapping(str string) (*RoleMapping, error)
func (*RoleMapping) Serialize ¶
func (rm *RoleMapping) Serialize() string
func (*RoleMapping) Validate ¶
func (rm *RoleMapping) Validate(c *KeycloakClient) error
type SmtpServer ¶
type SmtpServer map[string]interface{}
The available keys of the SMTP server map are not documented in Keycloak's API docs.