hyperAuth

package
v0.5.1-b2f2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// admin api
	KEYCLOAK_ADMIN_SERVICE_GET_TOKEN                          = "/auth/realms/master/protocol/openid-connect/token"
	KEYCLOAK_ADMIN_SERVICE_GET_CLIENTS                        = "/auth/admin/realms/tmax/clients"
	KEYCLOAK_ADMIN_SERVICE_CREATE_CLIENT                      = "/auth/admin/realms/tmax/clients"
	KEYCLOAK_ADMIN_SERVICE_DELETE_CLIENT                      = "/auth/admin/realms/tmax/clients/@@id@@"
	KEYCLOAK_ADMIN_SERVICE_CREATE_CLIENT_PROTOCOL_MAPPERS     = "/auth/admin/realms/tmax/clients/@@id@@/protocol-mappers/models"
	KEYCLOAK_ADMIN_SERVICE_CREATE_CLIENT_ROLES                = "/auth/admin/realms/tmax/clients/@@id@@/roles"
	KEYCLOAK_ADMIN_SERVICE_GET_CLIENT_ROLE_BY_NAME            = "/auth/admin/realms/tmax/clients/@@id@@/roles/@@roleName@@"
	KEYCLOAK_ADMIN_SERVICE_ADD_CLIENT_ROLE_TO_USER            = "/auth/admin/realms/tmax/users/@@userId@@/role-mappings/clients/@@id@@"
	KEYCLOAK_ADMIN_SERVICE_GET_CLIENT_SCOPES                  = "/auth/admin/realms/tmax/client-scopes"
	KEYCLOAK_ADMIN_SERVICE_ADD_DEFAULT_CLIENT_SCOPE_TO_CLIENT = "/auth/admin/realms/tmax/clients/@@id@@/default-client-scopes/@@clientScopeId@@"
	KEYCLOAK_ADMIN_SERVICE_GET_REALM_ROLE_BY_NAME             = "/auth/admin/realms/tmax/roles/@@roleName@@"
	KEYCLOAK_ADMIN_SERVICE_ADD_REALM_ROLE_TO_USER             = "/auth/admin/realms/tmax/users/@@userId@@/role-mappings/realm"
	KEYCLOAK_ADMIN_SERVICE_GET_GROUP                          = "/auth/admin/realms/tmax/groups"
	KEYCLOAK_ADMIN_SERVICE_CREATE_GROUP                       = "/auth/admin/realms/tmax/groups"
	KEYCLOAK_ADMIN_SERVICE_DELETE_GROUP                       = "/auth/admin/realms/tmax/groups/@@groupId@@"
	KEYCLOAK_ADMIN_SERVICE_ADD_GROUP_TO_USER                  = "/auth/admin/realms/tmax/users/@@userId@@/groups/@@groupId@@"
	KEYCLOAK_ADMIN_SERVICE_GET_USERS_BY_EMAIL                 = "/auth/admin/realms/tmax/users?exact=true&email=@@userEmail@@"
)
View Source
const (
	PROTOCOL_MAPPER_CONFIG_PROTOCOL_OPENID_CONNECT        = "openid-connect"
	PROTOCOL_MAPPER_CONFIG_PROTOCOL_NAME_AUDIENCE         = "oidc-audience-mapper"
	PROTOCOL_MAPPER_CONFIG_PROTOCOL_NAME_GROUP_MEMBERSHIP = "oidc-group-membership-mapper"
	PROTOCOL_MAPPER_CONFIG_PROTOCOL_NAME_USER_REALM_ROLE  = "oidc-usermodel-realm-role-mapper"
	PROTOCOL_MAPPER_CONFIG_PROTOCOL_NAME_USER_CLIENT_ROLE = "oidc-usermodel-client-role-mapper"
)
View Source
const (
	RESOURCE_TYPE_USER_EMAIL   = "UserEmail"
	RESOURCE_TYPE_CLIENT       = "Client"
	RESOURCE_TYPE_CLIENT_ROLE  = "ClientRole"
	RESOURCE_TYPE_REALM_ROLE   = "RealmRole"
	RESOURCE_TYPE_CLIENT_SCOPE = "ClientScop"
	RESOURCE_TYPE_GROUP        = "Group"
)

Variables

This section is empty.

Functions

func AddClientLevelRolesToUserRoleMapping

func AddClientLevelRolesToUserRoleMapping(config ClientLevelRoleConfig, userEmail string, secret *coreV1.Secret) error

func AddClientScopeToClient

func AddClientScopeToClient(config ClientScopeMappingConfig, secret *coreV1.Secret) error

func AddGroupToUser

func AddGroupToUser(userEmail string, config GroupConfig, secret *coreV1.Secret) error

func AddRealmLevelRolesToUserRoleMapping

func AddRealmLevelRolesToUserRoleMapping(roleName string, userEmail string, secret *coreV1.Secret) error

func CreateClient

func CreateClient(config ClientConfig, secret *coreV1.Secret) error

func CreateClientLevelProtocolMapper

func CreateClientLevelProtocolMapper(config ClientLevelProtocolMapperConfig, secret *coreV1.Secret) error

func CreateClientLevelRole

func CreateClientLevelRole(config ClientLevelRoleConfig, secret *coreV1.Secret) error

func CreateGroup

func CreateGroup(config GroupConfig, secret *coreV1.Secret) error

func DeleteClient

func DeleteClient(config ClientConfig, secret *coreV1.Secret) error

func DeleteGroup

func DeleteGroup(config GroupConfig, secret *coreV1.Secret) error

func GetClientRoleIdByRoleName

func GetClientRoleIdByRoleName(clientId string, roleName string, secret *coreV1.Secret) (string, error)

func GetClientScopesIdByName

func GetClientScopesIdByName(name string, secret *coreV1.Secret) (string, error)

func GetGroupIdByName

func GetGroupIdByName(name string, secret *coreV1.Secret) (string, error)

func GetIdByClientId

func GetIdByClientId(clientId string, secret *coreV1.Secret) (string, error)

func GetRealmRoleIdByRoleName

func GetRealmRoleIdByRoleName(roleName string, secret *coreV1.Secret) (string, error)

func GetTokenAsAdmin

func GetTokenAsAdmin(secret *coreV1.Secret) (string, error)

func GetUserIdByEmail

func GetUserIdByEmail(userEmail string, secret *coreV1.Secret) (string, error)

func IsNotFound

func IsNotFound(e error) bool

func IsOK

func IsOK(check int) bool

func SetServiceDomainURI

func SetServiceDomainURI(serviceName string, urlParameter map[string]string) string

Types

type ClientConfig

type ClientConfig struct {
	Id                        string   `json:"id,omitempty"`
	ClientId                  string   `json:"clientId,omitempty"`
	Secret                    string   `json:"secret,omitempty"`
	DirectAccessGrantsEnabled bool     `json:"directAccessGrantsEnabled,omitempty"`
	ImplicitFlowEnabled       bool     `json:"implicitFlowEnabled,omitempty"`
	RedirectUris              []string `json:"redirectUris,omitempty"`
}

func GetClientConfigPreset

func GetClientConfigPreset(prefix string) []ClientConfig

type ClientLevelProtocolMapperConfig

type ClientLevelProtocolMapperConfig struct {
	ClientId       string
	ProtocolMapper ProtocolMapperConfig
}

func GetMappingProtocolMapperToClientConfigPreset

func GetMappingProtocolMapperToClientConfigPreset(prefix string) []ClientLevelProtocolMapperConfig

type ClientLevelRoleConfig

type ClientLevelRoleConfig struct {
	ClientId string
	Role     RoleConfig
}

func GetClientLevelRoleConfigPreset

func GetClientLevelRoleConfigPreset(prefix string) []ClientLevelRoleConfig

type ClientScopeConfig

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

type ClientScopeMappingConfig

type ClientScopeMappingConfig struct {
	ClientId    string
	ClientScope ClientScopeConfig
}

func GetClientScopeMappingPreset

func GetClientScopeMappingPreset(prefix string) []ClientScopeMappingConfig

type GroupConfig

type GroupConfig struct {
	Id        string   `json:"id,omitempty"`
	Name      string   `json:"name,omitempty"`
	Path      string   `json:"path,omitempty"`
	SubGroups []string `json:"subGroups,omitempty"`
}

func GetGroupConfigPreset

func GetGroupConfigPreset(prefix string) []GroupConfig

type HyperAuthError

type HyperAuthError struct {
	NotFound bool
	Type     string
	Name     string
}

func (HyperAuthError) Error

func (e HyperAuthError) Error() string

type MapperConfig

type MapperConfig struct {
	IncludedClientAudience string `json:"included.client.audience,omitempty"`
	IncludedCustomAudience string `json:"included.custom.audience,omitempty"`
	Multivalued            bool   `json:"multivalued,omitempty"`
	ClaimName              string `json:"claim.name,omitempty"`
	FullPath               bool   `json:"full.path,omitempty"`
	JsonType               string `json:"jsonType,omitempty"`
	IdTokenClaim           bool   `json:"id.token.claim,omitempty"`
	AccessTokenClaim       bool   `json:"access.token.claim,omitempty"`
	UserInfoTokenClaim     bool   `json:"userinfo.token.claim,omitempty"`
}

type ProtocolMapperConfig

type ProtocolMapperConfig struct {
	Name           string       `json:"name,omitempty"`
	Protocol       string       `json:"protocol,omitempty"`
	ProtocolMapper string       `json:"protocolMapper,omitempty"`
	Config         MapperConfig `json:"config,omitempty"`
}

type RoleConfig

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

type UserConfig

type UserConfig struct {
	Id string `json:"id,omitempty"`
}

Jump to

Keyboard shortcuts

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