Skip to main content

auth

auth

import "github.com/cloudfoundry/go-cf-api/internal/apicommon/v3/auth"

Index

Constants

const (
Username = "username"
Scopes = "scopes"
)

Variables

var (
readScopes = []Scope{Read, Admin, AdminReadOnly, GlobalAuditor}
writeScopes = []Scope{Write, Admin}
)

func CanRead

func CanRead(c echo.Context) bool

func CanWrite

func CanWrite(c echo.Context) bool

func IsAdmin

func IsAdmin(c echo.Context) bool

func IsAdminReadOnly

func IsAdminReadOnly(c echo.Context) bool

func IsGlobalAuditor

func IsGlobalAuditor(c echo.Context) bool

func NewJWTMiddleware

func NewJWTMiddleware(keyFunc jwt.Keyfunc) echo.MiddlewareFunc

func NewRequiresReadMiddleware

func NewRequiresReadMiddleware() echo.MiddlewareFunc

func NewRequiresWriteMiddleware

func NewRequiresWriteMiddleware() echo.MiddlewareFunc

func NewSuccessHandler

func NewSuccessHandler() middleware.JWTSuccessHandler

func hasScope

func hasScope(scope Scope, c echo.Context) bool

func newRequiresScopesMiddleware

func newRequiresScopesMiddleware(scopes []Scope, verb string) echo.MiddlewareFunc

type CFClaims

type CFClaims struct {
Audience []string `json:"aud"`
ClientID string `json:"client_id,omitempty"`
ExpiresAt int64 `json:"exp,omitempty"`
ID string `json:"jti,omitempty"`
IssuedAt int64 `json:"iat,omitempty"`
Issuer string `json:"iss,omitempty"`
Subject string `json:"sub,omitempty"`
UserID string `json:"user_id"`
Username string `json:"user_name"`
Scopes []string `json:"scope"`
}

func (*CFClaims) Valid

func (c *CFClaims) Valid() error

type Scope

type Scope string
const (
Read Scope = "cloud_controller.read"
Write Scope = "cloud_controller.write"
Admin Scope = "cloud_controller.admin"
AdminReadOnly Scope = "cloud_controller.admin_read_only"
GlobalAuditor Scope = "cloud_controller.global_auditor"
)

Generated by gomarkdoc