Documentation ¶
Index ¶
- Variables
- func AuthMiddleware(ps *ArmoryCloudPrincipalService) func(handler http.Handler) http.Handler
- func GinAuthMiddleware(ps *ArmoryCloudPrincipalService) gin.HandlerFunc
- func WithPrincipal(ctx context.Context, principal ArmoryCloudPrincipal) context.Context
- type ArmoryCloudPrincipal
- type ArmoryCloudPrincipalService
- type JWT
- type JwtFetcher
- type JwtToken
- type PrincipalType
- type Settings
Constants ¶
This section is empty.
Variables ¶
View Source
var (
)Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(ps *ArmoryCloudPrincipalService) func(handler http.Handler) http.Handler
func GinAuthMiddleware ¶
func GinAuthMiddleware(ps *ArmoryCloudPrincipalService) gin.HandlerFunc
func WithPrincipal ¶
func WithPrincipal(ctx context.Context, principal ArmoryCloudPrincipal) context.Context
Types ¶
type ArmoryCloudPrincipal ¶
type ArmoryCloudPrincipal struct { Type PrincipalType `json:"type"` Name string `json:"name"` OrgId string `json:"orgId"` OrgName string `json:"orgName"` EnvId string `json:"envId"` ArmoryAdmin bool `json:"armoryAdmin"` Scopes []string `json:"scopes"` Groups []string `json:"groups"` }
func ExtractPrincipalFromContext ¶
func ExtractPrincipalFromContext(ctx context.Context) (*ArmoryCloudPrincipal, error)
ExtractPrincipalFromContext can be used by any handler or downstream middleware of the ArmoryCloudPrincipalMiddleware to get the encoded principal for manual verification of scopes.
func (*ArmoryCloudPrincipal) HasScope ¶
func (p *ArmoryCloudPrincipal) HasScope(scope string) bool
func (*ArmoryCloudPrincipal) String ¶
func (p *ArmoryCloudPrincipal) String() string
func (*ArmoryCloudPrincipal) Tenant ¶
func (p *ArmoryCloudPrincipal) Tenant() string
func (*ArmoryCloudPrincipal) ToJson ¶
func (p *ArmoryCloudPrincipal) ToJson() string
type ArmoryCloudPrincipalService ¶
type ArmoryCloudPrincipalService struct {
JwtFetcher JwtFetcher
}
func New ¶
func New(settings Settings) (*ArmoryCloudPrincipalService, error)
New creates an ArmoryCloudPrincipalService. It downloads JWKS from the Armory Auth Server & populates the JWK Cache for principal verification.
func (*ArmoryCloudPrincipalService) ExtractAndVerifyPrincipalFromTokenBytes ¶
func (a *ArmoryCloudPrincipalService) ExtractAndVerifyPrincipalFromTokenBytes(token []byte) (*ArmoryCloudPrincipal, error)
func (*ArmoryCloudPrincipalService) ExtractAndVerifyPrincipalFromTokenString ¶
func (a *ArmoryCloudPrincipalService) ExtractAndVerifyPrincipalFromTokenString(token string) (*ArmoryCloudPrincipal, error)
type JwtFetcher ¶
type PrincipalType ¶
type PrincipalType string
const ( User PrincipalType = "user" Machine PrincipalType = "machine" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.