hyperAuth

package
v0.5.0-b29f0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 10 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_CLIENT_SCOPE_TO_CLIENT     = "/auth/admin/realms/tmax/clients/@@id@@/optional-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"
	// hyperauth api
	HYPERAUTH_SERVICE_GET_USER_ID_BY_EMAIL = "/auth/realms/tmax/user/@@userEmail@@?token=@@token@@"
)
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"
)

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 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 DeleteClient

func DeleteClient(config ClientConfig, 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 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 IsClientExist

func IsClientExist(id string) 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 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