osiam

package
v0.0.0-...-01c0304 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const OsiamProviderName = "osiam"

Variables

This section is empty.

Functions

func OsiamBackendFactory

func OsiamBackendFactory(config map[string]string) (login.Backend, error)

Types

type Client

type Client struct {
	Endpoint     string
	ClientId     string
	ClientSecret string
}

func NewClient

func NewClient(endpoint string, clientId string, clientSecret string) *Client

func (*Client) GetTokenByPassword

func (c *Client) GetTokenByPassword(username, password string, scopes ...string) (authenticated bool, token *Token, err error)

Do an Osiam authorisation by Resource Owner Password Credentials Grant. If no scopes are supplied, the default scope ist 'me'.

type OsiamBackend

type OsiamBackend struct {
	// contains filtered or unexported fields
}

func NewOsiamBackend

func NewOsiamBackend(endpoint, clientId, clientSecret string) (*OsiamBackend, error)

NewOsiamBackend creates a new OSIAM Backend and verifies the parameters.

func (*OsiamBackend) Authenticate

func (b *OsiamBackend) Authenticate(username, password string) (bool, login.UserInfo, error)

type OsiamError

type OsiamError struct {
	Error   string
	Message string
}

func ParseOsiamError

func ParseOsiamError(jsonBody []byte) OsiamError

func (OsiamError) IsLoginError

func (e OsiamError) IsLoginError() bool

func (OsiamError) IsUnauthorized

func (e OsiamError) IsUnauthorized() bool

type Timestamp

type Timestamp struct {
	T time.Time
}

func (*Timestamp) IsSet

func (timestamp *Timestamp) IsSet() bool

func (*Timestamp) MarshalJSON

func (timestamp *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (timestamp *Timestamp) UnmarshalJSON(b []byte) (err error)

type Token

type Token struct {
	TokenType             string    `json:"token_type"`               // example "bearer"
	AccessToken           string    `json:"access_token"`             // example "79f479c2-c0d7-458a-8464-7eb887dbc943"
	RefreshToken          string    `json:"refresh_token"`            // example "3c7c4a87-dc91-4dd0-8ec8-d229a237a47c"
	ClientId              string    `json:"client_id"`                // example "example-client"
	UserName              string    `json:"user_name"`                // example "admin"
	Userid                string    `json:"user_id"`                  // example "84f6cffa-4505-48ec-a851-424160892283"
	Scope                 string    `json:"scope"`                    // example "ME"
	RefreshTokenExpiresAt Timestamp `json:"refresh_token_expires_at"` // example 1479309001813
	ExpiresAt             Timestamp `json:"expires_at"`               // example 1479251401814
	ExpiresIn             int       `json:"expires_in"`               // example 28795
}

Token represents an osiam auth token

Jump to

Keyboard shortcuts

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