auth

package
v0.0.0-...-9ac85d6 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultClient

func SetDefaultClient(c Service)

SetDefaultClient set auth client that will be returned by auth.DefaultClient

Types

type Client

type Client struct {
	URL string
	// contains filtered or unexported fields
}

Client used to access auth service

func NewClient

func NewClient(authURL string) *Client

NewClient create a new auth client

func (*Client) CreateRedirectURL

func (c *Client) CreateRedirectURL(to string) string

CreateRedirectURL gets us the URI which we are supposed to use to logging in with fabric8-auth Client on giving auth Client URL and redirectURL as input.

func (*Client) OSOTokenForCluster

func (c *Client) OSOTokenForCluster(clusterURL, accessToken string) (osoToken string, err error)

OSOTokenForCluster returns Openshift online token given the clusterURL and raw JWT token

func (*Client) UIDFromToken

func (c *Client) UIDFromToken(accessToken string) (sub string, err error)

UIDFromToken returns user identity given a raw jwt token

type MockAuth

type MockAuth struct {
	URL string
}

MockAuth is a mock implementation of auth service

func NewMockAuth

func NewMockAuth(authURL string) *MockAuth

NewMockAuth creates a mock auth client

func (*MockAuth) CreateRedirectURL

func (c *MockAuth) CreateRedirectURL(to string) string

CreateRedirectURL gets us the URI which we are supposed to use to logging in with fabric8-auth Client on giving auth Client URL and redirectURL as input.

func (*MockAuth) OSOTokenForCluster

func (c *MockAuth) OSOTokenForCluster(clusterURL, accessToken string) (osoToken string, err error)

OSOTokenForCluster returns Openshift online token given the clusterURL and raw JWT token

func (*MockAuth) UIDFromToken

func (c *MockAuth) UIDFromToken(accessToken string) (sub string, err error)

UIDFromToken returns user identity given a raw jwt token

type Service

type Service interface {
	UIDFromToken(accessToken string) (sub string, err error)
	OSOTokenForCluster(clusterURL, accessToken string) (osoToken string, err error)
	CreateRedirectURL(to string) string
}

Service talks to fabric8-auth for authentication and authorization

func DefaultClient

func DefaultClient() (Service, error)

DefaultClient returns default auth client

type TokenJSON

type TokenJSON struct {
	AccessToken      string `json:"access_token"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	Errors           []util.ErrorInfo
}

TokenJSON represents a JSON Web Token

Jump to

Keyboard shortcuts

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