jwtmapper

package
v0.0.0-...-85a8e8d Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "jwt"

ProviderName is identifier for role mapper provider

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Audience specifies audience claim
	Audience string `json:"audience" yaml:"audience"`
	// Issuer specifies issuer claim
	Issuer string `json:"issuer" yaml:"issuer"`
	// KeyID specifies ID of the current key
	KeyID string `json:"kid" yaml:"kid"`
	// Keys specifies list of issuer's keys
	Keys []*Key `json:"keys" yaml:"keys"`
	// DefaultRole specifies default role name
	DefaultRole string `json:"default_role" yaml:"default_role"`
	// RolesMap is a map of roles to list of users
	RolesMap map[string][]string `json:"roles" yaml:"roles"`
}

Config provides OAuth2 configuration

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig returns configuration loaded from a file

type Key

type Key struct {
	// ID of the key
	ID   string `json:"id" yaml:"id"`
	Seed string `json:"seed" yaml:"seed"`
}

Key for JWT signature

type Provider

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

Provider of OAuth2 identity

func Load

func Load(cfgfile string) (*Provider, error)

Load returns new Provider

func New

func New(cfg *Config) *Provider

New returns new Provider

func (*Provider) Applicable

func (p *Provider) Applicable(r *http.Request) bool

Applicable returns true if the request has autherization data applicable to the provider

func (*Provider) IdentityMapper

func (p *Provider) IdentityMapper(r *http.Request) (identity.Identity, error)

IdentityMapper interface

func (*Provider) SignToken

func (p *Provider) SignToken(userInfo *v1.UserInfo, deviceID string, expiry time.Duration) (*v1.Authorization, error)

SignToken returns signed JWT token with custom claims

Jump to

Keyboard shortcuts

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