api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSO_TOKEN_COOKIE = "lauth_token"
)

Variables

This section is empty.

Functions

func RandomDelay

func RandomDelay()

Types

type ErrorMessage

type ErrorMessage struct {
	Err          error       `json:"-"`
	RedirectURI  *url.URL    `json:"-"`
	ResponseType string      `json:"-"`
	State        string      `json:"state,omitempty"`
	Reason       ErrorReason `json:"error"`
	Description  string      `json:"error_description,omitempty"`
	ErrorURI     string      `json:"error_uri,omitempty"`
}

func (ErrorMessage) Error

func (msg ErrorMessage) Error() string

func (ErrorMessage) HTML added in v0.1.0

func (msg ErrorMessage) HTML(c *gin.Context)

func (ErrorMessage) JSON

func (msg ErrorMessage) JSON(c *gin.Context)

func (ErrorMessage) Redirect

func (msg ErrorMessage) Redirect(c *gin.Context)

func (ErrorMessage) Report

func (msg ErrorMessage) Report(r metrics.ErrorReporter)

func (ErrorMessage) StatusCode added in v0.1.0

func (msg ErrorMessage) StatusCode() int

func (ErrorMessage) Unwrap

func (msg ErrorMessage) Unwrap() error

type ErrorReason

type ErrorReason string
var (
	AccessDenied            ErrorReason = "access_denied"
	InvalidClient           ErrorReason = "invalid_client"
	InvalidGrant            ErrorReason = "invalid_grant"
	InvalidRequest          ErrorReason = "invalid_request"
	InvalidScope            ErrorReason = "invalid_scope"
	InvalidToken            ErrorReason = "invalid_token"
	RequestNotSupported     ErrorReason = "request_not_supported"
	RequestURINotSupported  ErrorReason = "request_uri_not_supported"
	ServerError             ErrorReason = "server_error"
	TemporarilyUnavailable  ErrorReason = "temporarily_unavailable"
	UnauthorizedClient      ErrorReason = "unauthorized_client"
	UnsupportedGrantType    ErrorReason = "unsupported_grant_type"
	UnsupportedResponseType ErrorReason = "unsupported_response_type"
)

func (ErrorReason) String

func (e ErrorReason) String() string

type GetAuthzRequest

type GetAuthzRequest struct {
	ResponseType string `form:"response_type" json:"response_type" xml:"response_type"`
	ClientID     string `form:"client_id"     json:"client_id"     xml:"client_id"`
	RedirectURI  string `form:"redirect_uri"  json:"redirect_uri"  xml:"redirect_uri"`
	Scope        string `form:"scope"         json:"scope"         xml:"scope"`
	State        string `form:"state"         json:"state"         xml:"state"`
	Nonce        string `form:"nonce"         json:"nonce"         xml:"nonce"`
	Prompt       string `form:"prompt"        json:"prompt"        xml:"prompt"`
	MaxAge       int64  `form:"max_age"       json:"max_age"       xml:"max_age"`
	LoginHint    string `form:"login_hint"    json:"login_hint"    xml:"login_hint"`
	Request      string `form:"request"       json:"request"       xml:"request"`
	RequestURI   string `form:"request_uri"   json:"request_uri"   xml:"request_uri"`
}

func (*GetAuthzRequest) Bind

func (req *GetAuthzRequest) Bind(c *gin.Context) *ErrorMessage

func (*GetAuthzRequest) Report

func (req *GetAuthzRequest) Report(c *metrics.Context)

func (GetAuthzRequest) Validate

func (req GetAuthzRequest) Validate(config *config.Config) *ErrorMessage

type GetUserInfoHeader

type GetUserInfoHeader struct {
	Authorization string `header:"Authorization"`
}

type LauthAPI

type LauthAPI struct {
	Connector    ldap.Connector
	Config       *config.Config
	TokenManager token.Manager
}

func (*LauthAPI) DeleteSSOToken added in v0.1.0

func (api *LauthAPI) DeleteSSOToken(c *gin.Context)

func (*LauthAPI) GetAuthz

func (api *LauthAPI) GetAuthz(c *gin.Context)

func (*LauthAPI) GetCerts

func (api *LauthAPI) GetCerts(c *gin.Context)

func (*LauthAPI) GetConfiguration

func (api *LauthAPI) GetConfiguration(c *gin.Context)

func (*LauthAPI) GetSSOToken added in v0.1.0

func (api *LauthAPI) GetSSOToken(c *gin.Context) (token.IDTokenClaims, error)

func (*LauthAPI) GetUserInfo

func (api *LauthAPI) GetUserInfo(c *gin.Context)

func (*LauthAPI) Logout added in v0.1.0

func (api *LauthAPI) Logout(c *gin.Context)

func (LauthAPI) MakeLoginSession

func (api LauthAPI) MakeLoginSession(clientIP, clientID string) (string, error)

func (*LauthAPI) PostAuthz

func (api *LauthAPI) PostAuthz(c *gin.Context)

func (*LauthAPI) PostToken

func (api *LauthAPI) PostToken(c *gin.Context)

func (*LauthAPI) SetErrorRoutes

func (api *LauthAPI) SetErrorRoutes(r *gin.Engine)

func (*LauthAPI) SetRoutes

func (api *LauthAPI) SetRoutes(r gin.IRoutes)

func (*LauthAPI) SetSSOToken added in v0.1.0

func (api *LauthAPI) SetSSOToken(c *gin.Context, subject string) error

type LogoutRequest added in v0.1.0

type LogoutRequest struct {
	IDTokenHint string `form:"id_token_hint"            json:"id_token_hint"            xml:"id_token_hint"`
	RedirectURI string `form:"post_logout_redirect_uri" json:"post_logout_redirect_uri" xml:"post_logout_redirect_uri"`
	State       string `form:"state"                    json:"state"                    xml:"state"`
}

func (*LogoutRequest) Bind added in v0.1.0

func (req *LogoutRequest) Bind(c *gin.Context) *ErrorMessage

type PostAuthzRequest

type PostAuthzRequest struct {
	GetAuthzRequest

	User       string `form:"username" json:"username" xml:"username"`
	Password   string `form:"password" json:"password" xml:"password"`
	LoginToken string `form:"session"  json:"session"  xml:"session"`
}

func (*PostAuthzRequest) Bind

func (req *PostAuthzRequest) Bind(c *gin.Context) *ErrorMessage

type PostTokenRequest

type PostTokenRequest struct {
	GrantType    string `form:"grant_type"    json:"grant_type"    xml:"grant_type"`
	Code         string `form:"code"          json:"code"          xml:"code"`
	RefreshToken string `form:"refresh_token" json:"refresh_token" xml:"refresh_token"`
	ClientID     string `form:"client_id"     json:"client_id"     xml:"client_id"`
	ClientSecret string `form:"client_secret" json:"client_secret" xml:"client_secret"`
	RedirectURI  string `form:"redirect_uri"  json:"redirect_uri"  xml:"redirect_uri"`
}

func (*PostTokenRequest) Bind

func (req *PostTokenRequest) Bind(c *gin.Context) *ErrorMessage

func (*PostTokenRequest) BindAndValidate

func (req *PostTokenRequest) BindAndValidate(c *gin.Context, conf *config.Config) *ErrorMessage

func (PostTokenRequest) Validate

func (req PostTokenRequest) Validate(conf *config.Config) *ErrorMessage

type PostTokenResponse

type PostTokenResponse struct {
	TokenType    string `json:"token_type"`
	AccessToken  string `json:"access_token"`
	IDToken      string `json:"id_token"`
	ExpiresIn    int64  `json:"expires_in"`
	Scope        string `json:"string"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

type StringSet

type StringSet []string

func ParseStringSet

func ParseStringSet(raw string) *StringSet

func (*StringSet) Add

func (ss *StringSet) Add(value string)

func (StringSet) Has

func (ss StringSet) Has(value string) bool

func (StringSet) List

func (ss StringSet) List() []string

func (StringSet) String

func (ss StringSet) String() string

func (StringSet) Validate

func (ss StringSet) Validate(what string, accepts []string) error

Jump to

Keyboard shortcuts

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