api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 16 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 AuthzContext added in v0.3.0

type AuthzContext struct {
	API     *LauthAPI
	Gin     *gin.Context
	Request *AuthzRequest
	Report  *metrics.Context
}

func NewAuthzContext added in v0.3.0

func NewAuthzContext(api *LauthAPI, c *gin.Context) (*AuthzContext, *errors.Error)

func (*AuthzContext) Close added in v0.3.0

func (ctx *AuthzContext) Close() error

func (*AuthzContext) ErrorRedirect added in v0.3.0

func (ctx *AuthzContext) ErrorRedirect(err *errors.Error)

func (*AuthzContext) MakeRequestObject added in v0.5.0

func (ctx *AuthzContext) MakeRequestObject() (string, error)

func (*AuthzContext) SendTokens added in v0.3.0

func (ctx *AuthzContext) SendTokens(subject string, authTime time.Time)

func (*AuthzContext) ShowConfirmPage added in v0.3.0

func (ctx *AuthzContext) ShowConfirmPage(code int, initialUser string)

func (*AuthzContext) ShowLoginPage added in v0.3.0

func (ctx *AuthzContext) ShowLoginPage(code int, initialUser string, errorDescription string)

func (*AuthzContext) TrySSO added in v0.3.0

func (ctx *AuthzContext) TrySSO(authorized bool) (proceed bool)

type AuthzRequest added in v0.3.0

type AuthzRequest 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"`
	MaxAge       int64  `form:"max_age"       json:"max_age"       xml:"max_age"`
	Prompt       string `form:"prompt"        json:"prompt"        xml:"prompt"`

	// use only GET method
	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"`

	// use only POST method
	User     string `form:"username" json:"username" xml:"username"`
	Password string `form:"password" json:"password" xml:"password"`

	RequestExpiresAt int64  `form:"-" json:"-" xml:"-"`
	RequestSubject   string `form:"-" json:"-" xml:"-"`
}

func (*AuthzRequest) RequestObjectClaims added in v0.5.0

func (req *AuthzRequest) RequestObjectClaims() token.RequestObjectClaims

type AuthzRequestUnmarshaller added in v0.5.0

type AuthzRequestUnmarshaller interface {
	GetRequest() *AuthzRequest
	PreProcess(api *LauthAPI) *errors.Error
}

type GetAuthzRequestUnmarshaller added in v0.5.0

type GetAuthzRequestUnmarshaller AuthzRequest

func (*GetAuthzRequestUnmarshaller) GetRequest added in v0.5.0

func (req *GetAuthzRequestUnmarshaller) GetRequest() *AuthzRequest

func (*GetAuthzRequestUnmarshaller) PreProcess added in v0.5.0

func (req *GetAuthzRequestUnmarshaller) PreProcess(api *LauthAPI) *errors.Error

type GetUserInfoRequest added in v0.2.0

type GetUserInfoRequest struct {
	Authorization string `form:"-" header:"Authorization"`
	Origin        string `form:"-" header:"Origin"`
}

func (*GetUserInfoRequest) Bind added in v0.2.0

func (req *GetUserInfoRequest) Bind(c *gin.Context) *errors.Error

func (GetUserInfoRequest) GetToken added in v0.2.0

func (req GetUserInfoRequest) GetToken() (string, *errors.Error)

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.SSOTokenClaims, 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) OptionsToken added in v0.6.0

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

func (*LauthAPI) OptionsUserInfo added in v0.6.0

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

func (*LauthAPI) PostAuthz

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

func (*LauthAPI) PostToken

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

func (*LauthAPI) PostUserInfo added in v0.2.0

func (api *LauthAPI) PostUserInfo(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, client string, authenticated bool) 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) *errors.Error

type OptionsUserInfoRequest added in v0.6.0

type OptionsUserInfoRequest struct {
	Origin string `header:"Origin"`
}

type PostAuthzRequestUnmarshaller added in v0.5.0

type PostAuthzRequestUnmarshaller struct {
	Request  string `form:"request"  json:"request"  xml:"request"`
	User     string `form:"username" json:"username" xml:"username"`
	Password string `form:"password" json:"password" xml:"password"`
	// contains filtered or unexported fields
}

func (*PostAuthzRequestUnmarshaller) GetRequest added in v0.5.0

func (req *PostAuthzRequestUnmarshaller) GetRequest() *AuthzRequest

func (*PostAuthzRequestUnmarshaller) PreProcess added in v0.5.0

func (req *PostAuthzRequestUnmarshaller) PreProcess(api *LauthAPI) *errors.Error

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) *errors.Error

func (*PostTokenRequest) BindAndValidate

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

func (PostTokenRequest) Validate

func (req PostTokenRequest) Validate(conf *config.Config) *errors.Error

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 PostUserInfoRequest added in v0.2.0

type PostUserInfoRequest struct {
	GetUserInfoRequest

	AccessToken string `form:"access_token" header:"-"`
}

func (*PostUserInfoRequest) Bind added in v0.2.0

func (req *PostUserInfoRequest) Bind(c *gin.Context) *errors.Error

func (PostUserInfoRequest) GetToken added in v0.2.0

func (req PostUserInfoRequest) GetToken() (string, *errors.Error)

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