model

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrScope      = "scope"
	AttrAud        = "audience"
	AttrCapability = "capability"
)

Defined attributes

View Source
const (
	AudienceParameterAudience = "audience"
	AudienceParameterResource = "resource"
)

Constants for audience parameters

Variables

View Source
var AllGrantTypes = api.AllGrantTypes

AllGrantTypes holds all defined GrantType strings

View Source
var AllRestrictionClaimStrings = api.AllRestrictionClaims

AllRestrictionClaimStrings holds all defined RestrictionClaim strings

View Source
var AllTokeninfoActions = api.AllTokeninfoActions

AllTokeninfoActions holds all defined TokenInfo strings

Attributes holds all defined attributes

View Source
var ResponseNYI = Response{
	Status:   fiber.StatusNotImplemented,
	Response: api.ErrorNYI,
}

ResponseNYI is the server response when something is not yet implemented

Functions

func BadRequestError added in v0.10.0

func BadRequestError(errorDescription string) api.Error

BadRequestError creates an Error for bad request errors

func ErrorWithErrorDescription added in v0.10.0

func ErrorWithErrorDescription(e string, err error) api.Error

ErrorWithErrorDescription creates an Error from an error string and golang error

func ErrorWithoutDescription added in v0.10.0

func ErrorWithoutDescription(err string) api.Error

ErrorWithoutDescription creates an Error from an error string

func InternalServerError added in v0.10.0

func InternalServerError(errorDescription string) api.Error

InternalServerError creates an Error for internal server errors

func InvalidTokenError added in v0.10.0

func InvalidTokenError(errorDescription string) api.Error

InvalidTokenError creates an Error for invalid token errors

func OIDCError added in v0.10.0

func OIDCError(oidcError, oidcErrorDescription string) api.Error

OIDCError creates an Error for oidc related errors

func OIDCErrorFromBody added in v0.10.0

func OIDCErrorFromBody(body []byte) (apiError api.Error, ok bool)

OIDCErrorFromBody creates an Error for oidc related errors from the response of an oidc provider

func OIDCFlowIsInSlice added in v0.10.0

func OIDCFlowIsInSlice(f OIDCFlow, s []OIDCFlow) bool

OIDCFlowIsInSlice checks if a OIDCFlow is present in a slice of OIDCFlows

Types

type AudienceConf added in v0.10.0

type AudienceConf struct {
	RFC8707           bool   `yaml:"use_rfc8707"`
	RequestParameter  string `yaml:"request_parameter"`
	SpaceSeparateAuds bool   `yaml:"space_separate_auds"`
}

AudienceConf is a type for holding configuration about audience

type GrantType added in v0.10.0

type GrantType int

GrantType is an enum like type for grant types

const (
	GrantTypeMytoken GrantType = iota
	GrantTypeOIDCFlow
	GrantTypePollingCode
	GrantTypeTransferCode
	GrantTypeSSH
)

GrantTypes

func NewGrantType added in v0.10.0

func NewGrantType(s string) GrantType

NewGrantType creates a new GrantType from the grant type string

func (GrantType) AddToSliceIfNotFound added in v0.10.0

func (g GrantType) AddToSliceIfNotFound(s *[]GrantType)

AddToSliceIfNotFound adds the GrantType to a slice s if it is not already there

func (GrantType) MarshalJSON added in v0.10.0

func (g GrantType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*GrantType) String added in v0.10.0

func (g *GrantType) String() string

func (*GrantType) UnmarshalJSON added in v0.10.0

func (g *GrantType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*GrantType) UnmarshalText added in v0.10.0

func (g *GrantType) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

func (*GrantType) UnmarshalYAML added in v0.10.0

func (g *GrantType) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*GrantType) Valid added in v0.10.0

func (g *GrantType) Valid() bool

Valid checks that GrantType is a defined grant type

type IPParseResult added in v0.10.0

type IPParseResult struct {
	IP    net.IP
	IPNet *net.IPNet
}

IPParseResult holds the result of ip parsing

type KeyValue added in v0.10.0

type KeyValue struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

KeyValue is a type for a key-value pair

type KeyValues added in v0.10.0

type KeyValues []KeyValue

KeyValues is a slice of KeyValue

type OIDCFlow added in v0.10.0

type OIDCFlow int

OIDCFlow is an enum like type for oidc flows

const (
	OIDCFlowAuthorizationCode OIDCFlow = iota
)

OIDCFlows

func NewOIDCFlow added in v0.10.0

func NewOIDCFlow(s string) OIDCFlow

NewOIDCFlow creates a new OIDCFlow from the flow string

func (OIDCFlow) AddToSliceIfNotFound added in v0.10.0

func (f OIDCFlow) AddToSliceIfNotFound(s *[]OIDCFlow)

AddToSliceIfNotFound adds the OIDCFlow to a slice s if it is not already there

func (OIDCFlow) MarshalJSON added in v0.10.0

func (f OIDCFlow) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*OIDCFlow) String added in v0.10.0

func (f *OIDCFlow) String() string

func (*OIDCFlow) UnmarshalJSON added in v0.10.0

func (f *OIDCFlow) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*OIDCFlow) UnmarshalYAML added in v0.10.0

func (f *OIDCFlow) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*OIDCFlow) Valid added in v0.10.0

func (f *OIDCFlow) Valid() bool

Valid checks that OIDCFlow is a defined flow

type Provider added in v0.10.0

type Provider interface {
	Name() string
	Issuer() string
	ClientID() string
	Scopes() []string
	Endpoints() *oauth2x.Endpoints
	Audience() *AudienceConf
	MaxMytokenLifetime() int64
	AddClientAuthentication(r *resty.Request, endpoint string) *resty.Request
	GetAuthorizationURL(
		rlog log.Ext1FieldLogger, state, pkceChallenge string, scopeRestrictions, audRestrictions []string,
	) (string, error)
}

Provider is an interface type for OIDC providers

type Response

type Response struct {
	// The Http Status code of the response
	Status int
	// The response body, will be marshalled as json
	Response interface{}
	// Cookies that should be set
	Cookies []*fiber.Cookie
}

Response models a http server response

func BadRequestErrorResponse added in v0.10.0

func BadRequestErrorResponse(msg string) *Response

BadRequestErrorResponse returns a error response for a not found error

func ErrorToBadRequestErrorResponse

func ErrorToBadRequestErrorResponse(err error) *Response

ErrorToBadRequestErrorResponse creates a bad request error response from a golang error

func ErrorToInternalServerErrorResponse

func ErrorToInternalServerErrorResponse(err error) *Response

ErrorToInternalServerErrorResponse creates an internal server error response from a golang error

func NotFoundErrorResponse added in v0.10.0

func NotFoundErrorResponse(msg string) *Response

NotFoundErrorResponse returns a error response for a not found error

func (Response) Send

func (r Response) Send(ctx *fiber.Ctx) error

Send sends this response using the passed fiber.Ctx

type ResponseType added in v0.10.0

type ResponseType int

ResponseType is an enum like type for response types

const (
	ResponseTypeToken ResponseType = iota
	ResponseTypeShortToken
	ResponseTypeTransferCode
)

ResponseTypes

func NewResponseType added in v0.10.0

func NewResponseType(s string) ResponseType

NewResponseType creates a new ResponseType from the given response type string

func (ResponseType) AddToSliceIfNotFound added in v0.10.0

func (r ResponseType) AddToSliceIfNotFound(s *[]ResponseType)

AddToSliceIfNotFound adds the ResponseType to a slice s if it is not already there

func (ResponseType) MarshalJSON added in v0.10.0

func (r ResponseType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*ResponseType) Scan added in v0.10.0

func (r *ResponseType) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (*ResponseType) String added in v0.10.0

func (r *ResponseType) String() string

func (*ResponseType) UnmarshalJSON added in v0.10.0

func (r *ResponseType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*ResponseType) UnmarshalYAML added in v0.10.0

func (r *ResponseType) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*ResponseType) Valid added in v0.10.0

func (r *ResponseType) Valid() bool

Valid checks that ResponseType is a defined flow

func (ResponseType) Value added in v0.10.0

func (r ResponseType) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type RestrictionClaim added in v0.5.0

type RestrictionClaim int

RestrictionClaim is an enum like type for restriction keys

const (
	RestrictionClaimNotBefore RestrictionClaim = iota
	RestrictionClaimExpiresAt
	RestrictionClaimScope
	RestrictionClaimAudiences
	RestrictionClaimHosts
	RestrictionClaimGeoIPAllow
	RestrictionClaimGeoIPDisallow
	RestrictionClaimUsagesAT
	RestrictionClaimUsagesOther
)

RestrictionClaims

func NewRestrictionClaim added in v0.5.0

func NewRestrictionClaim(s string) RestrictionClaim

NewRestrictionClaim creates a new RestrictionClaim from the grant type string

func (RestrictionClaim) MarshalJSON added in v0.5.0

func (rc RestrictionClaim) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*RestrictionClaim) String added in v0.5.0

func (rc *RestrictionClaim) String() string

func (*RestrictionClaim) UnmarshalJSON added in v0.5.0

func (rc *RestrictionClaim) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*RestrictionClaim) UnmarshalText added in v0.5.0

func (rc *RestrictionClaim) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

func (*RestrictionClaim) UnmarshalYAML added in v0.5.0

func (rc *RestrictionClaim) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*RestrictionClaim) Valid added in v0.5.0

func (rc *RestrictionClaim) Valid() bool

Valid checks that RestrictionClaim is a defined grant type

type RestrictionClaims added in v0.5.0

type RestrictionClaims []RestrictionClaim

RestrictionClaims is a slice of RestrictionClaim

var AllRestrictionClaims RestrictionClaims

AllRestrictionClaims holds all defined RestrictionClaims

func (RestrictionClaims) Disable added in v0.5.0

func (rks RestrictionClaims) Disable(disable RestrictionClaims) (left RestrictionClaims)

Disable subtracts the passed RestrictionClaims from this RestrictionClaims and returns the left RestrictionClaims

func (RestrictionClaims) Has added in v0.5.0

Has checks if a RestrictionClaim is in a RestrictionClaims

type TokeninfoAction added in v0.10.0

type TokeninfoAction int

TokeninfoAction is an enum like type for tokeninfo actions

const (
	TokeninfoActionIntrospect TokeninfoAction = iota
	TokeninfoActionEventHistory
	TokeninfoActionSubtokenTree
	TokeninfoActionListMytokens
	TokeninfoActionNotifications
)

TokeninfoActions

func NewTokeninfoAction added in v0.10.0

func NewTokeninfoAction(s string) TokeninfoAction

NewTokeninfoAction creates a new TokeninfoAction from the tokeninfo action string

func (TokeninfoAction) AddToSliceIfNotFound added in v0.10.0

func (a TokeninfoAction) AddToSliceIfNotFound(s *[]TokeninfoAction)

AddToSliceIfNotFound adds the TokeninfoAction to a slice s if it is not already there

func (TokeninfoAction) MarshalJSON added in v0.10.0

func (a TokeninfoAction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*TokeninfoAction) String added in v0.10.0

func (a *TokeninfoAction) String() string

func (*TokeninfoAction) UnmarshalJSON added in v0.10.0

func (a *TokeninfoAction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*TokeninfoAction) UnmarshalYAML added in v0.10.0

func (a *TokeninfoAction) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*TokeninfoAction) Valid added in v0.10.0

func (a *TokeninfoAction) Valid() bool

Valid checks that TokeninfoAction is a defined tokeninfo action

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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