auth

package
v0.1.0-alpha-2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth はユーザー認証サービスです

func (*Auth) ValidateToken

func (a *Auth) ValidateToken(tokenStr string) (*jwt.Token, error)

ValidateToken はCognitoUserPoolのJWTを検証します

type Authenticator

type Authenticator interface {
	ValidateToken(token string) (*jwt.Token, error)
}

Authenticator はユーザー認証サービスです

func New

func New(idp IdentityProvider, opt *Option) (Authenticator, error)

New initializes Cognito UserPool authenticator

type IdentityProvider

type IdentityProvider interface {
	JWK() (map[string]JWKKey, error)
	Issuer() string
	Audience() string
}

IdentityProvider provides the information to authenticate user.

type JWK

type JWK struct {
	Keys []JWKKey
}

JWK is json data struct for JSON Web Key.

type JWKKey

type JWKKey struct {
	Alg string
	E   string
	Kid string
	Kty string
	N   string
	Use string
}

JWKKey is json data struct for cognito jwk key.

type Option

type Option struct {
	NoVerification bool
}

Option defines Auth options

type UserPool

type UserPool struct {
	PoolID      string
	Region      string
	AppClientID string
}

UserPool has CognitoUserPool JWT auth info.

func (*UserPool) Audience

func (up *UserPool) Audience() string

Audience returns aud for JWT claims

func (*UserPool) Issuer

func (up *UserPool) Issuer() string

Issuer returns iss for JWT claims

func (*UserPool) JWK

func (up *UserPool) JWK() (map[string]JWKKey, error)

JWK gets CognitoUserPool's JWK

func (*UserPool) JWKURL

func (up *UserPool) JWKURL() string

JWKURL returns Cognito UserPool's JWK URL.

func (*UserPool) URL

func (up *UserPool) URL() string

URL returns Cognito UserPool's URL.

Jump to

Keyboard shortcuts

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