dbauth

package
v0.0.0-...-6b47566 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxHTTPBodySize defines max http body size
	MaxHTTPBodySize = 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectHandler

type DirectHandler struct {
	logger.L
	ProviderName string
	TokenService provider.TokenService
	Issuer       string
	AvatarSaver  provider.AvatarSaver
	CredChecker  ICredChecker
}

DirectHandler implements non-oauth2 provider authorizing user in traditional way with storage with users and hashes

func (DirectHandler) AuthHandler

func (p DirectHandler) AuthHandler(w http.ResponseWriter, r *http.Request)

AuthHandler doesn't do anything for direct login as it has no callbacks

func (DirectHandler) LoginHandler

func (p DirectHandler) LoginHandler(w http.ResponseWriter, r *http.Request)

LoginHandler checks "user" and "passwd" against data store and makes jwt if all passed.

GET /something?user=name&passwd=xyz&aud=bar&sess=[0|1]

POST /something?sess[0|1] Accepts application/x-www-form-urlencoded or application/json encoded requests.

application/x-www-form-urlencoded body example: user=name&passwd=xyz&aud=bar

application/json body example:

{
  "user": "name",
  "passwd": "xyz",
  "aud": "bar",
}

func (DirectHandler) LogoutHandler

func (p DirectHandler) LogoutHandler(w http.ResponseWriter, r *http.Request)

LogoutHandler - GET /logout

func (DirectHandler) Name

func (p DirectHandler) Name() string

Name of the handler

type ICredChecker

type ICredChecker func(user string, password string) (ok bool, err error)

Jump to

Keyboard shortcuts

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