Documentation
¶
Index ¶
- Constants
- func AgentTokenCredentialKey(token string) string
- func GenerateAgentToken() (string, error)
- func LooksLikeAgentToken(token string) bool
- func ModeFromContext(ctx context.Context) string
- func RequestToken(request *http.Request) (string, bool, error)
- func StaticCredentialKey(tokenID string) string
- func WithClaims(ctx context.Context, claims Claims) context.Context
- func WithMode(ctx context.Context, mode string) context.Context
- type Claims
- type Config
- type Error
- type Policy
- func (p *Policy) AuthenticateRequest(request *http.Request, scope Scope) (Claims, error)
- func (p *Policy) AuthenticateToken(value string, scope Scope) (Claims, error)
- func (p *Policy) Bearer() bool
- func (p *Policy) CheckOrigin(request *http.Request) bool
- func (p *Policy) Enabled() bool
- func (p *Policy) IsSecureRequest(request *http.Request) bool
- func (p *Policy) Mode() string
- func (p *Policy) None() bool
- func (p *Policy) Open() bool
- func (p *Policy) StaticClaimsForToken(value string) (Claims, bool)
- type Scope
- type TokenConfig
Constants ¶
View Source
const ( ModeNone = "none" ModeBearer = "bearer" ModeOpen = "open" )
View Source
const AgentTokenPrefix = "magt_v1_"
View Source
const CookieName = "moltnet_auth"
Variables ¶
This section is empty.
Functions ¶
func AgentTokenCredentialKey ¶ added in v0.1.1
func GenerateAgentToken ¶ added in v0.1.1
func LooksLikeAgentToken ¶ added in v0.1.1
func ModeFromContext ¶ added in v0.1.1
func StaticCredentialKey ¶ added in v0.1.1
Types ¶
type Claims ¶
type Claims struct {
TokenID string
CredentialKey string
// contains filtered or unexported fields
}
func NewAgentTokenClaims ¶ added in v0.1.1
func NewCredentialClaims ¶ added in v0.1.1
func NewStaticClaims ¶ added in v0.1.1
func NewStaticClaims(config TokenConfig) Claims
func (Claims) AgentToken ¶ added in v0.1.1
func (Claims) AllowsAgent ¶
func (Claims) HasAgentRestriction ¶ added in v0.1.1
func (Claims) StaticToken ¶ added in v0.1.1
type Config ¶
type Config struct {
Mode string
ListenAddr string
AllowedOrigins []string
TrustForwardedProto bool
Tokens []TokenConfig
}
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
func (*Policy) AuthenticateRequest ¶
func (*Policy) AuthenticateToken ¶ added in v0.1.1
Click to show internal directories.
Click to hide internal directories.