authkit

package module
v0.0.0-...-1717a6b Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2018 License: MIT Imports: 8 Imported by: 0

README

authkit

Documentation

Overview

Package authkit provides convenient methods to deal with authentication.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrJWKNotFound informs that JWK was not found.
	ErrJWKNotFound = errors.New("JWK not found")
)

Functions

This section is empty.

Types

type JSONWebKeyer

type JSONWebKeyer interface {
	JSONWebKeyForToken(token *jwt.JSONWebToken) (jose.JSONWebKey, error)
}

JSONWebKeyer can provide a JWK for a JWT.

type JWKSClient

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

JWKSClient represents a client for a remote JWK Set.

func NewJWKSClient

func NewJWKSClient(url string) *JWKSClient

NewJWKSClient returns a new client for a remote JWK Set represented by url.

func (*JWKSClient) JSONWebKey

func (c *JWKSClient) JSONWebKey(ID string) (jose.JSONWebKey, error)

JSONWebKey returns a JWK by its id.

func (*JWKSClient) JSONWebKeyForToken

func (c *JWKSClient) JSONWebKeyForToken(token *jwt.JSONWebToken) (jose.JSONWebKey, error)

JSONWebKeyForToken returns a JWK for the token.

type RS256Validator

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

RS256Validator validates RS256 JWTs.

func NewRS256Validator

func NewRS256Validator(audience, issuer string, keyer JSONWebKeyer) *RS256Validator

NewRS256Validator returns new validator for RS256 JWTs. It checks tokens for RS256 algorithm, audience, issuer, expiration, and uses keyer to retrieve public key to verify token signature.

func (*RS256Validator) ValidClaims

func (v *RS256Validator) ValidClaims(token string, dst ...interface{}) error

ValidClaims validates token and decodes its claims into dst if valid.

Directories

Path Synopsis
Package httpauth provides http utilities for auth.
Package httpauth provides http utilities for auth.

Jump to

Keyboard shortcuts

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