Documentation
¶
Overview ¶
Package auth provides tokens for calls to other services (SEC-03, CLI-10).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnsignedToken ¶
UnsignedToken builds a token without signature. It is accepted only by services that do not verify signatures: the in-process test client, and permissions-v2 when a user's resources are listed for the deletion of that user, as device-repository does.
func UnsignedTokens ¶
UnsignedTokens returns unsigned tokens of users with the role "user"; for tests.
Types ¶
type TokenExchange ¶
type TokenExchange struct {
// contains filtered or unexported fields
}
TokenExchange gets tokens of other users through Keycloak token exchange, so that work on behalf of an owner runs with the owner's rights (SEC-06). Tokens are cached until shortly before they expire.
func NewTokenExchange ¶
func NewTokenExchange(endpoint string, clientId string, clientSecret string) *TokenExchange
type TokenSource ¶
TokenSource returns a token including the "Bearer " prefix.
func ClientCredentials ¶
func ClientCredentials(endpoint string, clientId string, clientSecret string) TokenSource
ClientCredentials gets and refreshes a token of a Keycloak client; endpoint is the Keycloak base URL, e.g. http://keycloak:8080.
type UserTokenSource ¶
UserTokenSource returns a token of a user including the "Bearer " prefix.