Documentation
¶
Index ¶
- Constants
- Variables
- type IdsecAuth
- type IdsecAuthBase
- func (a *IdsecAuthBase) Authenticate(profile *models.IdsecProfile, authProfile *auth.IdsecAuthProfile, ...) (*auth.IdsecToken, error)
- func (a *IdsecAuthBase) IsAuthenticated(profile *models.IdsecProfile) bool
- func (a *IdsecAuthBase) LoadAuthentication(profile *models.IdsecProfile, refreshAuth bool) (*auth.IdsecToken, error)
- func (a *IdsecAuthBase) ResolveCachePostfix(authProfile *auth.IdsecAuthProfile) string
- type IdsecISPAuth
- func (a *IdsecISPAuth) Authenticate(profile *models.IdsecProfile, authProfile *auth.IdsecAuthProfile, ...) (*auth.IdsecToken, error)
- func (a *IdsecISPAuth) AuthenticatorHumanReadableName() string
- func (a *IdsecISPAuth) AuthenticatorName() string
- func (a *IdsecISPAuth) DefaultAuthMethod() (auth.IdsecAuthMethod, auth.IdsecAuthMethodSettings)
- func (a *IdsecISPAuth) IsAuthenticated(profile *models.IdsecProfile) bool
- func (a *IdsecISPAuth) LoadAuthentication(profile *models.IdsecProfile, refreshAuth bool) (*auth.IdsecToken, error)
- func (a *IdsecISPAuth) SupportedAuthMethods() []auth.IdsecAuthMethod
Constants ¶
const (
DefaultTokenLifetime = 3600
)
DefaultTokenLifetime is the default token lifetime in seconds.
Variables ¶
var ( // SupportedAuthenticatorsList is a list of supported authenticators. SupportedAuthenticatorsList = []IdsecAuth{ NewIdsecISPAuth(true), } // SupportedAuthenticators is a map of supported authenticators. SupportedAuthenticators = func() map[string]IdsecAuth { authenticators := make(map[string]IdsecAuth) for _, auth := range SupportedAuthenticatorsList { authenticators[auth.AuthenticatorName()] = auth } return authenticators }() // SupportedAuthMethods is a list of supported authentication methods. SupportedAuthMethods = func() []auth.IdsecAuthMethod { authMethods := make([]auth.IdsecAuthMethod, 0) for _, auth := range SupportedAuthenticatorsList { for _, method := range auth.SupportedAuthMethods() { if !slices.Contains(authMethods, method) { authMethods = append(authMethods, method) } } } return authMethods }() )
Functions ¶
This section is empty.
Types ¶
type IdsecAuth ¶
type IdsecAuth interface {
// AuthenticatorName returns the name of the authenticator.
AuthenticatorName() string
// AuthenticatorHumanReadableName returns a human-readable name for the authenticator.
AuthenticatorHumanReadableName() string
// SupportedAuthMethods returns a list of supported authentication methods.
SupportedAuthMethods() []auth.IdsecAuthMethod
// IsAuthenticated checks if the authentication is already loaded for the specified profile.
IsAuthenticated(profile *models.IdsecProfile) bool
// DefaultAuthMethod returns the default authentication method and its settings.
DefaultAuthMethod() (auth.IdsecAuthMethod, auth.IdsecAuthMethodSettings)
// LoadAuthentication loads the authentication token for the specified profile and refreshes it if necessary.
// It returns the authentication token and an error if any occurred.
LoadAuthentication(profile *models.IdsecProfile, refreshAuth bool) (*auth.IdsecToken, error)
// Authenticate performs authentication using the specified profile and authentication profile.
// If profile is not passed (nil), will try to use the auth profile alone, but at least one of them needs to be passed
// Secret may optionally be passed if needed for the authentication type
// If force is true, it will force re-authentication even if a valid token is already present
// If refreshAuth is true, it will attempt to refresh the token if it is expired
// It returns the authentication token and an error if any occurred.
Authenticate(profile *models.IdsecProfile, authProfile *auth.IdsecAuthProfile, secret *auth.IdsecSecret, force bool, refreshAuth bool) (*auth.IdsecToken, error)
// contains filtered or unexported methods
}
IdsecAuth is an interface that defines the methods for authentication in the Idsec SDK.
func NewIdsecISPAuth ¶
NewIdsecISPAuth creates a new instance of IdsecISPAuth.
type IdsecAuthBase ¶
type IdsecAuthBase struct {
Authenticator IdsecAuth
Logger *common.IdsecLogger
CacheAuthentication bool
CacheKeyring keyring.IdsecKeyringInterface
Token *auth.IdsecToken
ActiveProfile *models.IdsecProfile
ActiveAuthProfile *auth.IdsecAuthProfile
}
IdsecAuthBase is a struct that implements the IdsecAuth interface and provides common functionality for authentication.
func NewIdsecAuthBase ¶
func NewIdsecAuthBase(cacheAuthentication bool, name string, authenticator IdsecAuth) *IdsecAuthBase
NewIdsecAuthBase creates a new instance of IdsecAuthBase.
func (*IdsecAuthBase) Authenticate ¶
func (a *IdsecAuthBase) Authenticate(profile *models.IdsecProfile, authProfile *auth.IdsecAuthProfile, secret *auth.IdsecSecret, force bool, refreshAuth bool) (*auth.IdsecToken, error)
Authenticate performs authentication using the specified profile and authentication profile.
func (*IdsecAuthBase) IsAuthenticated ¶
func (a *IdsecAuthBase) IsAuthenticated(profile *models.IdsecProfile) bool
IsAuthenticated checks if the authentication is already loaded for the specified profile.
func (*IdsecAuthBase) LoadAuthentication ¶
func (a *IdsecAuthBase) LoadAuthentication(profile *models.IdsecProfile, refreshAuth bool) (*auth.IdsecToken, error)
LoadAuthentication loads the authentication token for the specified profile and refreshes it if necessary.
func (*IdsecAuthBase) ResolveCachePostfix ¶
func (a *IdsecAuthBase) ResolveCachePostfix(authProfile *auth.IdsecAuthProfile) string
ResolveCachePostfix resolves the cache postfix for the authentication profile.
type IdsecISPAuth ¶
type IdsecISPAuth struct {
IdsecAuth
*IdsecAuthBase
}
IdsecISPAuth is a struct that implements the IdsecAuth interface for the Identity Security Platform.
func (*IdsecISPAuth) Authenticate ¶
func (a *IdsecISPAuth) Authenticate(profile *models.IdsecProfile, authProfile *auth.IdsecAuthProfile, secret *auth.IdsecSecret, force bool, refreshAuth bool) (*auth.IdsecToken, error)
Authenticate performs authentication using the specified profile and authentication profile.
func (*IdsecISPAuth) AuthenticatorHumanReadableName ¶
func (a *IdsecISPAuth) AuthenticatorHumanReadableName() string
AuthenticatorHumanReadableName returns the human-readable name of the ISP authenticator.
func (*IdsecISPAuth) AuthenticatorName ¶
func (a *IdsecISPAuth) AuthenticatorName() string
AuthenticatorName returns the name of the ISP authenticator.
func (*IdsecISPAuth) DefaultAuthMethod ¶
func (a *IdsecISPAuth) DefaultAuthMethod() (auth.IdsecAuthMethod, auth.IdsecAuthMethodSettings)
DefaultAuthMethod returns the default authentication method and its settings for the ISP authenticator.
func (*IdsecISPAuth) IsAuthenticated ¶
func (a *IdsecISPAuth) IsAuthenticated(profile *models.IdsecProfile) bool
IsAuthenticated checks if the user is authenticated using the specified profile.
func (*IdsecISPAuth) LoadAuthentication ¶
func (a *IdsecISPAuth) LoadAuthentication(profile *models.IdsecProfile, refreshAuth bool) (*auth.IdsecToken, error)
LoadAuthentication loads the authentication token from the cache or performs authentication if not found.
func (*IdsecISPAuth) SupportedAuthMethods ¶
func (a *IdsecISPAuth) SupportedAuthMethods() []auth.IdsecAuthMethod
SupportedAuthMethods returns the supported authentication methods for the ISP authenticator.