auth

package
v0.0.0-...-bf90f01 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: Apache-2.0 Imports: 23 Imported by: 20

Documentation

Index

Constants

View Source
const InternalFeatureLevel = "internal"

Variables

This section is empty.

Functions

func PlainText

func PlainText(token string) (string, error)

PlainText is a Decode function that can be used to fetch tokens that are not encrypted. Simply return the same token back

func ValidateResponse

func ValidateResponse(ctx context.Context, c *authclient.Client, res *http.Response) error

ValidateResponse function when given client and response checks if the response has any errors by also looking at the status code

Types

type Decode

type Decode func(data string) (string, error)

Decode a function to decode a given value

func NewGPGDecypter

func NewGPGDecypter(passphrase string) Decode

NewGPGDecypter takes a passphrase and returns a GPG based Decypter decode function

type JSONKeys

type JSONKeys struct {
	Keys []interface{} `json:"keys"`
}

JSONKeys the JSON structure for unmarshalling the keys

type PublicKey

type PublicKey struct {
	KeyID string
	Key   *rsa.PublicKey
}

PublicKey a public key loaded from auth service

type Service

type Service interface {
	GetUser(ctx context.Context) (*User, error)
	GetAuthURL() string
	NewSaClient() (*authclient.Client, error)
	ResolveUserToken(ctx context.Context, target, userToken string) (user, accessToken string, err error)
	ResolveSaToken(ctx context.Context, target string) (username, accessToken string, err error)
	GetPublicKeys() ([]*rsa.PublicKey, error)
}

func NewAuthService

func NewAuthService(config *configuration.Data, options ...configuration.HTTPClientOption) (Service, error)

NewAuthService retrieves SA OAuth token and creates a service instance that is the main point for communication with auth service

func NewAuthServiceWithToken

func NewAuthServiceWithToken(config *configuration.Data, saToken string, options ...configuration.HTTPClientOption) Service

NewAuthService creates a service instance that is the main point for communication with auth service

type TenantToken

type TenantToken struct {
	Token *jwt.Token
}

TenantToken the token on the tenant

func (TenantToken) Email

func (t TenantToken) Email() string

Email returns the value of the `email` claim in the token

func (TenantToken) Subject

func (t TenantToken) Subject() uuid.UUID

Subject returns the value of the `sub` claim in the token

func (TenantToken) Username

func (t TenantToken) Username() string

Username returns the value of the `preferred_username` claim in the token

type User

type User struct {
	ID                 uuid.UUID
	UserData           *authclient.UserDataAttributes
	OpenShiftUsername  string
	OpenShiftUserToken string
}

User contains user data retrieved from auth service and OS username and user token

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL