server

package
v1.0.0-alpha.69 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package server provides an http oauth REST API

Index

Constants

View Source
const (
	// AuthRequestParam is the name of the request token parameter
	AuthRequestParam = "request_token"
)

Variables

View Source
var (
	// DefaultCodeChallengeMethod is the only challenge method
	DefaultCodeChallengeMethod = "S256"
)

Functions

This section is empty.

Types

type AuthorizeParams

type AuthorizeParams struct {
	AppURI              *string  `json:"app_uri"`
	Audience            string   `json:"audience"`
	ClientID            string   `json:"client_id"`
	CodeChallenge       string   `json:"code_challenge"`
	CodeChallengeMethod *string  `json:"code_challenge_method"`
	RedirectURI         *string  `json:"redirect_uri"`
	ResponseType        string   `json:"response_type"`
	Scope               []string `json:"scope"`
	State               *string  `json:"state"`
}

AuthorizeParams contains all the bound params for the authorize operation

func (*AuthorizeParams) Validate

func (p *AuthorizeParams) Validate() error

Validate validates the params

type LoginParams

type LoginParams struct {
	Login        string `json:"login"`
	Password     string `json:"password"`
	RequestToken string `json:"request_token"`
}

LoginParams contains all the bound params for the login operation

func (LoginParams) Validate

func (p LoginParams) Validate() error

Validate validates LoginParams

type LogoutParams

type LogoutParams struct {
	Audience    string  `json:"audience"`
	ClientID    string  `json:"client_id"`
	RedirectURI *string `json:"redirect_uri"`
	State       *string `json:"state"`
}

LogoutParams contains all the bound params for the logout operation

func (LogoutParams) Validate

func (p LogoutParams) Validate() error

Validate validates LogoutParams

type Option

type Option func(s *Server)

Option provides the server options, these will override th defaults and instance values.

func WithAllowedGrants

func WithAllowedGrants(g oauth.Permissions) Option

WithAllowedGrants sets allowed grants

func WithAuthorizer

func WithAuthorizer(a oauth.Authorizer) Option

WithAuthorizer sets the oauth.Authorizer for the necessary calls

func WithCodeStore

func WithCodeStore(c oauth.CodeStore) Option

WithCodeStore changes the default code store for the server

func WithSessionStore

func WithSessionStore(c oauth.SessionStore) Option

WithSessionStore changes the default session store for the server

type Server

type Server struct {
	*api.Server
	// contains filtered or unexported fields
}

Server is an API server it can be used standalone vi Server() or integrared via Handler()

func New

func New(ctrl oauth.Controller, opts ...interface{}) *Server

New returns a new Server instance

type SignupParams

type SignupParams struct {
	Email        string  `json:"email"`
	InviteCode   *string `json:"invite_code"`
	Login        string  `json:"login"`
	Name         *string `json:"name"`
	Password     string  `json:"password"`
	RequestToken string  `json:"request_token"`
}

SignupParams contains all the bound params for the signup operation

func (SignupParams) Validate

func (p SignupParams) Validate() error

Validate validates SignupParams

type TokenParams

type TokenParams struct {
	Audience        string   `json:"audience"`
	ClientID        string   `json:"client_id"`
	ClientSecret    *string  `json:"client_secret,omitempty"`
	Code            *string  `json:"code,omitempty"`
	CodeVerifier    *string  `json:"code_verifier"`
	GrantType       string   `json:"grant_type"`
	Password        *string  `json:"password,omitempty"`
	RefreshNonce    *string  `json:"refresh_nonce,omitempty"`
	RefreshToken    *string  `json:"refresh_token,omitempty"`
	RefreshVerifier *string  `json:"refresh_verifier,omitempty"`
	Scope           []string `json:"scope,omitempty"`
	Username        *string  `json:"username,omitempty"`
}

TokenParams contains all the bound params for the token operation

func (TokenParams) Validate

func (p TokenParams) Validate() error

Validate validate TokenParams

type UserInfoUpdateParams

type UserInfoUpdateParams struct {
	Profile oauth.Profile `json:"profile,omitempty"`
}

UserInfoUpdateParams contains all the bound params for the user info update operation

Jump to

Keyboard shortcuts

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