Documentation
¶
Index ¶
- Variables
- func DatabaseSetApplicationWithConfig(dbCfg DatabaseTransaction) echo.MiddlewareFunc
- func DatabaseTransactionWithConfig(dbCfg DatabaseTransaction) echo.MiddlewareFunc
- func DefaultAppkeySkipper(c echo.Context) bool
- func DefaultAppkeyValidator(appkey string) middleware.KeyAuthValidator
- func DefaultAuthAppkeyConfig(appkey string) middleware.KeyAuthConfig
- func DefaultDatabaseSkipper(echo.Context) bool
- func DefaultErrorHandler() middleware.KeyAuthErrorHandler
- func DefaultJwtAuthSkipper(echo.Context) bool
- func DefaultResourceAcessSkipper(echo.Context) bool
- func DefaultScopeFromContext(c echo.Context, scopeVariable string) string
- func DefaultSkipper(echo.Context) bool
- func GetPublicKeyFromCwbiRealm(url string) (string, error)
- func GetRsaPublicKey(publicKey string) (*rsa.PublicKey, error)
- func GetRsaPublicKeyFromCwbiRealm(url string) (*rsa.PublicKey, error)
- func ResourceAccessWithConfig(accessConfig ResourceAccessConfig) echo.MiddlewareFunc
- func S3Satic(S3StaticConfig S3StaticConfig) echo.MiddlewareFunc
- func S3StaticWithConfig(staticConfig S3StaticConfig) echo.MiddlewareFunc
- func StringArrayMatch(arr1 []string, arr2 []string) bool
- type AuthorizeCustomClaims
- type DatabaseTransaction
- type DbConfigurtion
- type JwtAuthenticateConfig
- type ResourceAccessConfig
- type S3StaticConfig
Constants ¶
This section is empty.
Variables ¶
var ( DefaultDatabaseTransaction = ResourceAccessConfig{ Skipper: DefaultDatabaseSkipper, } )
var ( DefaultJwtAuthenticateConfig = JwtAuthenticateConfig{ Skipper: DefaultJwtAuthSkipper, } )
var ( DefaultResourceAccessConfig = ResourceAccessConfig{ Skipper: DefaultResourceAcessSkipper, } )
var ( DefaultS3StaticConfig = S3StaticConfig{ Skipper: DefaultSkipper, Index: "index.html", Prefix: "/", } )
Functions ¶
func DatabaseSetApplicationWithConfig ¶
func DatabaseSetApplicationWithConfig(dbCfg DatabaseTransaction) echo.MiddlewareFunc
func DatabaseTransactionWithConfig ¶
func DatabaseTransactionWithConfig(dbCfg DatabaseTransaction) echo.MiddlewareFunc
func DefaultAppkeySkipper ¶
DefaultSkipper returns false which processes the middleware.
func DefaultAppkeyValidator ¶
func DefaultAppkeyValidator(appkey string) middleware.KeyAuthValidator
DefaultAppkeyValidator validates the application key
func DefaultAuthAppkeyConfig ¶
func DefaultAuthAppkeyConfig(appkey string) middleware.KeyAuthConfig
func DefaultDatabaseSkipper ¶
DefaultDatabaseSkipper returns false which processes the middleware.
func DefaultErrorHandler ¶
func DefaultErrorHandler() middleware.KeyAuthErrorHandler
DefaultErrorHandler
func DefaultJwtAuthSkipper ¶
DefaultSkipper returns false which processes the middleware.
func DefaultResourceAcessSkipper ¶
DefaultResourceAcessSkipper returns false which processes the middleware.
func DefaultScopeFromContext ¶
DefaultScopeFromContext
func DefaultSkipper ¶
DefaultSkipper returns false which processes the middleware.
func GetPublicKeyFromCwbiRealm ¶ added in v1.0.1
func GetRsaPublicKey ¶ added in v1.0.1
func GetRsaPublicKeyFromCwbiRealm ¶ added in v1.0.1
func ResourceAccessWithConfig ¶
func ResourceAccessWithConfig(accessConfig ResourceAccessConfig) echo.MiddlewareFunc
AuthResourceAccessWithConfig
func S3StaticWithConfig ¶
func S3StaticWithConfig(staticConfig S3StaticConfig) echo.MiddlewareFunc
S3StaticWithConfig returns S3Static middleware with config See `S3Static()`
func StringArrayMatch ¶ added in v1.0.1
Types ¶
type AuthorizeCustomClaims ¶
type AuthorizeCustomClaims struct {
AuthrorizedParty string `json:"azp,omitempty"`
ResourceAccess map[string]any `json:"resource_access,omitempty"`
PreferredUsername string `json:"preferred_username,omitempty"`
Name string `json:"name,omitempty"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
Subject string `json:"sub,omitempty"`
Audience []string `json:"aud,omitempty"`
// jwt.StandardClaims // this is for 'aud' that is a string
jwt.MapClaims // start using this with custom claims
}
AuthorizeStandardClaims struct for ParseWithClaims
type DatabaseTransaction ¶
type DatabaseTransaction struct {
// Skipper defines a function to skip middleware.
// Returning true skips processing the middleware.
Skipper func(c echo.Context) bool
// sql query
SQL *string
// key used in the default query
// required when SQL not provided
Key *string
// Application Configuration
Config *any
// Application Configuration attribute
ConfigFieldName *string
// database connection pool
Connection *pgxpool.Pool
}
ResourceAccessConfig struct defining needed fields to validate and authorize
type DbConfigurtion ¶
type JwtAuthenticateConfig ¶
type JwtAuthenticateConfig struct {
// Skipper defines a function to skip middleware
// Returning true skips processing the middleware.
Skipper func(c echo.Context) bool
// ApplicationKey is the key to validate the application
ApplicationKey string
// PublicKeyRaw is the public key to validate the token
PublicKeyRaw string
// PublicKey is the public key to validate the token as rsa.PublicKey
// This is typically set by the middleware
PublicKey *rsa.PublicKey
// TokenRoles is the role(s) from the token
TokenRoles []any
// SigningMethod is the signing method for the token algorithm
// Determined from the token
SigningMethod string
}
JwtAuthenticateConfig struct defining needed fields to validate and authorize
func (*JwtAuthenticateConfig) AuthParseWithClaims ¶
func (a *JwtAuthenticateConfig) AuthParseWithClaims() echo.MiddlewareFunc
AuthParseWithClaims
type ResourceAccessConfig ¶
type ResourceAccessConfig struct {
// Skipper defines a function to skip middleware.
// Returning true skips processing the middleware.
Skipper func(c echo.Context) bool
// Roles is the list of roles to authorize
Roles []string
// Role separator.
// Optional. Default value ""
RoleSeparator string
// Typically the office of the user defined in routes
Scope string
// Scope Variable
// Optional. Default value "symbol"
ScopeVariable string
// ScopeFromContext func to get the scope
// Typically from the route and is most likely an office symbol
ScopeFromContext func(c echo.Context, scopeVariable string) string
// Context key. Use this if jwtAuth sets something different than 'user'
// Optional. Default value "user"
ContextKey string
// Claims.
Claims AuthorizeCustomClaims
}
ResourceAccessConfig struct defining needed fields to validate and authorize
type S3StaticConfig ¶
type S3StaticConfig struct {
// Skipper defines a function to skip middleware. Returning true skips processing
// the middleware.
Skipper func(c echo.Context) bool
// Aws Configuration
// Required.
AwsConfig aws.Config
// S3 bucket.
// Required.
Bucket string `yaml:"bucket"`
// Allows you to enable the client to use path-style addressing, i.e.,
// https://s3.amazonaws.com/BUCKET/KEY . By default, the S3 client will use virtual
// hosted bucket addressing when possible( https://BUCKET.s3.amazonaws.com/KEY ).
UsePathStyle bool
// Prefix limits the response to keys that begin with the specified prefix.
// Optional. Default value "/"
Prefix string `yaml:"prefix"`
// PrefixFunc is a function that returns the prefix to use for the request.
PrefixFunc func(c echo.Context) string `yaml:"prefixfunc"`
// IgnoreBase is a regexp to ignore
// Optional.
IgnoreBaseRegex string `yaml:"ignorebaseregex"`
// Index file for serving content.
// Optional. Default value "index.html".
Index string `yaml:"index"`
}
func (*S3StaticConfig) IgnoreBase ¶
func (s *S3StaticConfig) IgnoreBase(pin string) (pout string, err error)
IgnoreBase