Documentation
¶
Overview ¶
Package server provides an http oauth REST API
Index ¶
- Constants
- Variables
- func EnsureURI(uri string, search []string) (*url.URL, error)
- type AuthorizeParams
- type LoginParams
- type LogoutParams
- type Option
- type PasswordCreateParams
- type PasswordType
- type PasswordUpdateParams
- type Server
- type SessionParams
- type SignupParams
- type TokenParams
- type UserInfoUpdateParams
- type VerifyParams
- type VerifySendParams
Constants ¶
const (
// AuthRequestParam is the name of the request token parameter
AuthRequestParam = "request_token"
)
Variables ¶
var (
// DefaultCodeChallengeMethod is the only challenge method
DefaultCodeChallengeMethod = "S256"
)
Functions ¶
Types ¶
type AuthorizeParams ¶
type AuthorizeParams struct {
AppURI *string `json:"app_uri"`
Audience *string `json:"audience,omitempty"`
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
type LogoutParams ¶
type LogoutParams struct {
Audience *string `json:"audience,omitempty"`
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 ¶
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 PasswordCreateParams ¶
type PasswordCreateParams struct {
Login string `json:"login"`
Notify oauth.NotificationChannels `json:"notify"`
Type PasswordType `json:"type"`
RequestToken *string `json:"request_token,omitempty"`
RedirectURI *oauth.URI `json:"redirect_uri,omitempty"`
CodeVerifier *string `json:"code_verifier,omitempty"`
}
PasswordCreateParams is the input to the password get route
func (PasswordCreateParams) Validate ¶
func (p PasswordCreateParams) Validate() error
Validate validates PasswordGetInput
type PasswordType ¶
type PasswordType string
PasswordType defines a password type
const ( // PasswordTypeLink is a magic password link PasswordTypeLink PasswordType = "link" // PasswordTypeCode is a one-time use password code PasswordTypeCode PasswordType = "code" // PasswordTypeReset sends both a link with the password scope and a code PasswordTypeReset PasswordType = "reset" )
func (PasswordType) Validate ¶
func (p PasswordType) Validate() error
Validate validates the PasswordType
type PasswordUpdateParams ¶
type PasswordUpdateParams struct {
Password string `json:"password"`
ResetCode string `json:"reset_code"`
RedirectURI *oauth.URI `json:"redirect_uri"`
}
PasswordUpdateParams are used by the password update route
func (PasswordUpdateParams) Validate ¶
func (p PasswordUpdateParams) Validate() error
Validate validates PasswordGetInput
type Server ¶
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
func (*Server) Sessions ¶
func (s *Server) Sessions() oauth.SessionStore
Sessions returns the sessions
type SessionParams ¶
type SessionParams struct {
RequestToken string `json:"request_token"`
AuthCode bool `json:"auth_code"`
RedirectURI *oauth.URI `json:"redirect_ur"`
State *string `json:"state,omitempty"`
}
SessionParams is the session request parameters
type SignupParams ¶
type SignupParams struct {
Email *string `json:"email,omitempty"`
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,omitempty"`
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
type UserInfoUpdateParams ¶
UserInfoUpdateParams contains all the bound params for the user info update operation
type VerifyParams ¶
type VerifyParams struct {
RedirectURI string `json:"redirect_uri"`
}
VerifyParams contains the email verify params
func (VerifyParams) Validate ¶
func (p VerifyParams) Validate() error
Validate validates UserEmailVerifyParams
type VerifySendParams ¶
type VerifySendParams struct {
Method oauth.NotificationChannel `json:"method"`
// contains filtered or unexported fields
}
VerifySendParams are the params for the verification send method