oauth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package oauth exposes function to forge and validate JWT tokens

Index

Constants

This section is empty.

Variables

View Source
var (
	Config         oauthmodel.Config
	UserRepository oauthmodel.UserRepository
	Now            = time.Now
)

Functions

func Authenticate

func Authenticate(tokenString string) (oauthmodel.Authentication, oauthmodel.Identity, error)

Authenticate verifies JWT and create an access token to use with DPhoto APIs

func Authorise

func Authorise(tokenString string, queryPt *AuthoriseQuery) (*oauthmodel.Claims, error)

Authorise tests the validity of the JWT token (signature and issuer), and the presence of the scopes.

func IsInvalidTokenError

func IsInvalidTokenError(err error) bool

IsInvalidTokenError returns true if authenticated failed because of an invalid token.

func IsNotPreregisteredError

func IsNotPreregisteredError(err error) bool

IsNotPreregisteredError returns true when authentication failed because user is not pre-registered

Types

type AuthoriseQuery

type AuthoriseQuery struct {
	Owners map[string]string
	Scopes []string
}

func NewAuthoriseQuery

func NewAuthoriseQuery(scopes ...string) *AuthoriseQuery

func (*AuthoriseQuery) WithOwner

func (q *AuthoriseQuery) WithOwner(owner string, permission string) *AuthoriseQuery

Jump to

Keyboard shortcuts

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