Documentation
¶
Overview ¶
Package authnclient with administration facing methods
Package authnclient with consumer facing methods.
Index ¶
- func NewAuthnService(authnConfig authn.AuthnConfig) authn.IAuthnService
- func NewAuthnServiceFactory(f factory.IModuleFactory) (modules.IHiveModule, error)
- func NewAuthnUserHttpService(httpServer transports.IHttpServer) modules.IHiveModule
- type AuthnAdminMsgClient
- func (m *AuthnAdminMsgClient) AddClient(clientID string, displayName string, role string, pubKey string) (token string, err error)
- func (m *AuthnAdminMsgClient) AdminGetClientProfile(co *clientspkg.Consumer, clientID string) (profile authnapi.ClientProfile, err error)
- func (m *AuthnAdminMsgClient) AdminGetProfiles(co *clientspkg.Consumer) (clientProfiles []authnapi.ClientProfile, err error)
- func (m *AuthnAdminMsgClient) AdminRemoveClient(hc *clientspkg.Consumer, clientID string) (err error)
- func (m *AuthnAdminMsgClient) AdminSetClientPassword(hc *clientspkg.Consumer, userName string, password string) (err error)
- func (m *AuthnAdminMsgClient) AdminUpdateClientProfile(clientProfile authnapi.ClientProfile) (err error)
- type AuthnUserHttpClient
- func (cl *AuthnUserHttpClient) Close()
- func (cl *AuthnUserHttpClient) ConnectWithToken(clientID string, token string) (err error)
- func (cl *AuthnUserHttpClient) GetProfile() (profile authn.ClientProfile, err error)
- func (cl *AuthnUserHttpClient) GetTlsClient() transports.ITLSClient
- func (cl *AuthnUserHttpClient) LoginWithPassword(clientID string, password string) (newToken string, err error)
- func (cl *AuthnUserHttpClient) Logout(token string) (err error)
- func (cl *AuthnUserHttpClient) RefreshToken(oldToken string) (newToken string, err error)
- type AuthnUserMsgClient
- func (m *AuthnUserMsgClient) GetProfile() (resp authn.ClientProfile, err error)
- func (m *AuthnUserMsgClient) Logout() (err error)
- func (m *AuthnUserMsgClient) RefreshToken(hc *clientspkg.Consumer, oldToken string) (newToken string, err error)
- func (m *AuthnUserMsgClient) UpdateProfile(hc *clientspkg.Consumer, password string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthnService ¶
func NewAuthnService( authnConfig authn.AuthnConfig) authn.IAuthnService
NewAuthnService create a new instance of the authentication service using RRN messaging. This service offers the ability to manage clients.
To support the http auth endpoint first start pkg.NewAuthnHttpService and link it to this module.
authnConfig contains the password storage and token management configuration httpServer to server the http endpoint or nil to not use http.
func NewAuthnServiceFactory ¶
func NewAuthnServiceFactory(f factory.IModuleFactory) (modules.IHiveModule, error)
Create a new instance of the authentication service using the factory environment. The factory will provide the configuration and http server. This sets the authn session manager as the factory authenticator.
func NewAuthnUserHttpService ¶
func NewAuthnUserHttpService(httpServer transports.IHttpServer) modules.IHiveModule
Create a module instance for handling authn requests over http Intended for supporting user requests such as login, logout, and refreshToken.
This module provides passthrough for all requests and responses and injects new requests received over http. The authn module must be installed downstream to handle these requests.
Types ¶
type AuthnAdminMsgClient ¶
type AuthnAdminMsgClient struct {
modules.HiveModuleBase
// contains filtered or unexported fields
}
AuthnAdminMsgClient is a client module for authentication management using RRN messages. This should be linked to a transport client module for message delivery.
func NewAuthnAdminMsgClient ¶
func NewAuthnAdminMsgClient() *AuthnAdminMsgClient
Create a new instance of the authentication administration messaging client
func (*AuthnAdminMsgClient) AddClient ¶
func (m *AuthnAdminMsgClient) AddClient(clientID string, displayName string, role string, pubKey string) ( token string, err error)
AdminAddAgent client method - Add Agent. Create an account for IoT device agents
func (*AuthnAdminMsgClient) AdminGetClientProfile ¶
func (m *AuthnAdminMsgClient) AdminGetClientProfile(co *clientspkg.Consumer, clientID string) ( profile authnapi.ClientProfile, err error)
AdminGetClientProfile client method - Get Client Profile. Get the profile information describing a client
func (*AuthnAdminMsgClient) AdminGetProfiles ¶
func (m *AuthnAdminMsgClient) AdminGetProfiles(co *clientspkg.Consumer) (clientProfiles []authnapi.ClientProfile, err error)
AdminGetProfiles client method - Get Profiles. Get a list of all client profiles
func (*AuthnAdminMsgClient) AdminRemoveClient ¶
func (m *AuthnAdminMsgClient) AdminRemoveClient(hc *clientspkg.Consumer, clientID string) (err error)
AdminRemoveClient client method - Remove Client. Remove a client account
func (*AuthnAdminMsgClient) AdminSetClientPassword ¶
func (m *AuthnAdminMsgClient) AdminSetClientPassword(hc *clientspkg.Consumer, userName string, password string) (err error)
AdminSetClientPassword client method - Set Client Password. Update the password of a consumer
func (*AuthnAdminMsgClient) AdminUpdateClientProfile ¶
func (m *AuthnAdminMsgClient) AdminUpdateClientProfile(clientProfile authnapi.ClientProfile) (err error)
AdminUpdateClientProfile client method - Update Client Profile. Update the details of a client
type AuthnUserHttpClient ¶
type AuthnUserHttpClient struct {
// contains filtered or unexported fields
}
AuthnUserHttpClient is a http client for authentication operations such as login using http requests. This is a simple API for clients to be able to obtain an auth token and refresh it.
func NewUserAuthnHttpClient ¶
func NewUserAuthnHttpClient(serverURL string, caCert *x509.Certificate) *AuthnUserHttpClient
NewUserAuthnHttpClient creates an instance of the authentication client to login and obtain auth tokens.
serverURL is the host:port of the http server caCert is the server CA
func (*AuthnUserHttpClient) Close ¶
func (cl *AuthnUserHttpClient) Close()
Close the underlying TLS client used by the authentication client
func (*AuthnUserHttpClient) ConnectWithToken ¶
func (cl *AuthnUserHttpClient) ConnectWithToken(clientID string, token string) (err error)
set the clientID and authn token this client uses
func (*AuthnUserHttpClient) GetProfile ¶
func (cl *AuthnUserHttpClient) GetProfile() (profile authn.ClientProfile, err error)
Return the client's profile. The client must be authenticated first.
func (*AuthnUserHttpClient) GetTlsClient ¶
func (cl *AuthnUserHttpClient) GetTlsClient() transports.ITLSClient
Return the TLS client used to connect to the authn server. This can be used anywhere an http client is needed for the same server.
func (*AuthnUserHttpClient) LoginWithPassword ¶
func (cl *AuthnUserHttpClient) LoginWithPassword(clientID string, password string) (newToken string, err error)
func (*AuthnUserHttpClient) Logout ¶
func (cl *AuthnUserHttpClient) Logout(token string) (err error)
func (*AuthnUserHttpClient) RefreshToken ¶
func (cl *AuthnUserHttpClient) RefreshToken(oldToken string) (newToken string, err error)
Use the http address to request a token refresh
type AuthnUserMsgClient ¶
type AuthnUserMsgClient struct {
modules.HiveModuleBase
// contains filtered or unexported fields
}
AuthnUserMsgClient is a client module for authentication operations using RRN messages. This should be linked to a transport client module for message delivery.
func NewAuthnUserMsgClient ¶
func NewAuthnUserMsgClient() *AuthnUserMsgClient
Create a new instance of the authn messaging consumer client This only creates the messages This must be linked with a transport client to reach the server
func (*AuthnUserMsgClient) GetProfile ¶
func (m *AuthnUserMsgClient) GetProfile() (resp authn.ClientProfile, err error)
UserGetProfile client method - Get Client Profile.
func (*AuthnUserMsgClient) Logout ¶
func (m *AuthnUserMsgClient) Logout() (err error)
Logout client method - Logout. Logout from all devices
func (*AuthnUserMsgClient) RefreshToken ¶
func (m *AuthnUserMsgClient) RefreshToken(hc *clientspkg.Consumer, oldToken string) (newToken string, err error)
UserRefreshToken client method - Request a new auth token for the current client.
func (*AuthnUserMsgClient) UpdateProfile ¶
func (m *AuthnUserMsgClient) UpdateProfile(hc *clientspkg.Consumer, password string) (err error)
UserUpdatePassword client method - Update Password. Request changing the password of the current client