auth

package
v0.0.0-...-8aa1adc Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotOAuth = errors.Base("request does not contain oauth header")

ErrNotOAuth missing oauth header

Functions

This section is empty.

Types

type UserInfo

type UserInfo struct {
	Acr               string              `mapstructure:"acr"`
	AllowedOrigins    []string            `json:"allowed-origins"`
	Aud               []string            `mapstructure:"aud"`
	Azp               string              `mapstructure:"azp"`
	Email             string              `mapstructure:"email"`
	EmailVerified     bool                `mapstructure:"email_verified"`
	Exp               int64               `mapstructure:"exp"`
	FamilyName        string              `mapstructure:"family_name"`
	GivenName         string              `mapstructure:"given_name"`
	Iat               int64               `mapstructure:"iat"`
	Iss               string              `mapstructure:"iss"`
	Jti               string              `mapstructure:"jti"`
	Name              string              `mapstructure:"name"`
	PreferredUsername string              `mapstructure:"preferred_username"`
	RealmAccess       map[string][]string `mapstructure:"realm_access"`
	ResourceAccess    struct {
		Commentron struct {
			Roles []string `mapstructure:"roles"`
		} `mapstructure:"commentron"`
	} `mapstructure:"resource_access"`
	Scope        string `mapstructure:"scope"`
	SessionState string `mapstructure:"session_state"`
	Sid          string `mapstructure:"sid"`
	Sub          string `mapstructure:"sub"`
	Typ          string `mapstructure:"typ"`
}

UserInfo contains all claim information included in the access token.

func Authenticate

func Authenticate(r *http.Request, authorization *commentapi.Authorization) (*model.Channel, *UserInfo, error)

Authenticate regular authentication

func ModAuthenticate

func ModAuthenticate(r *http.Request, modAuthorization *commentapi.ModAuthorization) (*model.Channel, *model.Channel, *UserInfo, error)

ModAuthenticate authenticates a moderator

Jump to

Keyboard shortcuts

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