auth

package
v0.0.0-...-1baf13c Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Oidcc

type Oidcc struct {
	Issuer       string `json:"issuer"`
	ClientID     string `json:"clientId"`
	ClientSecret string `json:"clientSecret"`

	Username string        `json:"username"`
	Password string        `json:"password"`
	Tok      *oauth2.Token `json:"token"`

	Disable bool `json:"-"`

	sync.Mutex `json:"-"`
}

Oidcc Oidc client

func (*Oidcc) Token

func (o *Oidcc) Token() (*oauth2.Token, error)

Token fetch token from oidc provider

type Oidcs

type Oidcs struct {
	Issuer string `json:"issuer"`

	Disable bool `json:"-"`

	sync.Mutex `json:"-"`
	// contains filtered or unexported fields
}

Oidcs Oidc client only with issuer parameter

func (*Oidcs) Verify

func (o *Oidcs) Verify(ctx context.Context, token string) (context.Context, error)

Verify check if a token if valid or not, and set the plain token info into the user context key

type User

type User struct {
	Subject        string `json:"sub"`
	Email          string `json:"email"`
	Mobile         string `json:"mobile"`
	Name           string `json:"name"`
	Token          string `json:"Token"`
	EmailVerified  bool   `json:"email_verified"`
	MobileVerified bool   `json:"mobile_verified"`

	// original claims
	Claims json.RawMessage
}

User represents the user info from Token or user info

func UserInfo

func UserInfo(ctx context.Context) User

UserInfo obtain user info from context

Jump to

Keyboard shortcuts

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