domain

package
v3.0.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: OSL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Guest = &User{
	Name: "Guest",
	Type: GUEST,
}

Guest is our default guest user

OAuthRoleUser represents basic role for authorized user

Functions

This section is empty.

Types

type Auth

type Auth struct {
	TokenSource oauth2.TokenSource
	IDToken     *oidc.IDToken
}

Auth information

type LoginEvent

type LoginEvent struct {
	Session *web.Session
}

LoginEvent for the current session

type LogoutEvent

type LogoutEvent struct {
	Session *web.Session
}

LogoutEvent for the current session

type TokenExtras

type TokenExtras map[string]string

TokenExtras for openID Connect

func (*TokenExtras) Add

func (te *TokenExtras) Add(key string, value string)

Add a value to a key

func (*TokenExtras) Get

func (te *TokenExtras) Get(key string) (string, bool)

Get a calue from a key

type User

type User struct {
	Sub          string
	Name         string
	Email        string
	Salutation   string
	FirstName    string
	LastName     string
	Street       string
	ZipCode      string
	City         string
	DateOfBirth  string
	Country      string
	CustomFields map[string]string
	Type         UserType
}

User is a basic authenticated user

func (User) Get

func (u User) Get(name string) string

Get a custom field by the name

type UserMappingService

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

UserMappingService maps a user based on data available via the idTokenMapping setting

func (*UserMappingService) Inject

func (ums *UserMappingService) Inject(config *struct {
	IDTokenMapping config.Map `inject:"config:auth.mapping.idToken"`
})

Inject dependencies

func (*UserMappingService) MapToUser

func (ums *UserMappingService) MapToUser(claims map[string]interface{}, session *web.Session) *User

MapToUser returns the user mapped from the claims

func (*UserMappingService) UserFromIDToken

func (ums *UserMappingService) UserFromIDToken(idToken *oidc.IDToken, session *web.Session) (*User, error)

UserFromIDToken returns a user mapped with data from a provided OpenID connect token

type UserType

type UserType string

UserType such as guest or user

const (
	// GUEST user
	GUEST UserType = "guest"

	// USER is an authenticated user
	USER UserType = "user"
)

Jump to

Keyboard shortcuts

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