Documentation ¶
Index ¶
- Constants
- func New(conf config.AdminConfig) (client admin.DirectoryAdministrationClient, err error)
- func NewCredentials(tokenKeys map[string]string, audience string) (_ admin.Credentials, err error)
- func NewCredentialsFromTokens(tm *tokens.TokenManager) (_ admin.Credentials, err error)
- type Credentials
- func (c *Credentials) Generate(api admin.DirectoryAdministrationClient) (err error)
- func (c *Credentials) Login(api admin.DirectoryAdministrationClient) (accessToken, _ string, err error)
- func (c *Credentials) Logout(api admin.DirectoryAdministrationClient) (err error)
- func (c *Credentials) Refresh(api admin.DirectoryAdministrationClient) (accessToken, _ string, err error)
- func (c *Credentials) Valid() bool
Constants ¶
const ( HD = "hd" Email = "bff@rotational.io" Name = "GDS BFF" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(conf config.AdminConfig) (client admin.DirectoryAdministrationClient, err error)
New creates a new DirectoryAdministrationClient which uses its own self signed credentials to make authenticated requests to a GDS Admin service.
func NewCredentials ¶
NewCredentials creates a new Credentials object with the given token keys and audience which can generate self signed access tokens for authenticated requests.
func NewCredentialsFromTokens ¶
func NewCredentialsFromTokens(tm *tokens.TokenManager) (_ admin.Credentials, err error)
NewCredentialsFromTokens creates a new Credentials object from a token manager for testing purposes.
Types ¶
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
Credentials implements the admin.Credentials interface to provide access tokens to authenticated requests.
func (*Credentials) Generate ¶
func (c *Credentials) Generate(api admin.DirectoryAdministrationClient) (err error)
Generate signs a new access token using the token manager if a valid one does not already exist.
func (*Credentials) Login ¶
func (c *Credentials) Login(api admin.DirectoryAdministrationClient) (accessToken, _ string, err error)
Login creates new access and refresh tokens if they don't already exist.
func (*Credentials) Logout ¶
func (c *Credentials) Logout(api admin.DirectoryAdministrationClient) (err error)
Logout deletes the access token.
func (*Credentials) Refresh ¶
func (c *Credentials) Refresh(api admin.DirectoryAdministrationClient) (accessToken, _ string, err error)
Refresh
func (*Credentials) Valid ¶
func (c *Credentials) Valid() bool
Check if the access token is valid and not expired.