Documentation
¶
Index ¶
- Variables
- func EncodeFederateNext(next string) (string, error)
- func Federate(w http.ResponseWriter, r *http.Request, cookieName string, ...)
- func FederateSetup() error
- func FederateVerify(w http.ResponseWriter, r *http.Request)
- func GetSession(r *http.Request, name string) (*sessions.Session, error)
- func GetStore() *sessions.CookieStore
- func NewSession(name string) *sessions.Session
- func OIDCAuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
- func OIDCSetup(issuer, host string) error
- func OIDCVerify(code string) (string, error)
- func OIDCVerifyToken(ctx context.Context, token *oauth2.Token) (string, error)
- func OIDCVerifyTokenID(ctx context.Context, rawID string) (string, error)
- func RandHex32() (string, error)
- func SAMLFilter(w http.ResponseWriter, r *http.Request, sessionStore SessionStore, ...) (bool, error)
- func SAMLHandleStartAuthFlow(w http.ResponseWriter, r *http.Request)
- func SAMLMiddleware() *samlsp.Middleware
- func SAMLSetup(host string) error
- func SetupSession() error
- func TokenAuth(r *http.Request) string
- type OIDCClaims
- type OIDCConfigI
- type OIDCVerifierI
- type Session
- type SessionStore
- type TokenUser
Constants ¶
This section is empty.
Variables ¶
var ( FederateAccessKey = flag.String("federate-access", "", "shared secret, 64 chars, enables federation") FederateSecretKey = flag.String("federate-secret", "", "internal secret, 64 chars") )
var ( OIDCIssuer = flag.String("oidc-issuer", "https://accounts.google.com", "OIDC issuer URL provided by IdP") OIDCClientID = flag.String("oidc-client-id", "f8b8b020-4ec2-0135-6452-027de1ec0c4e43491", "OIDC client ID") OIDCClientSecret = flag.String("oidc-client-secret", "cxLF74XOeRRFDJbKuJpZAOtL4pVPK1t2XGVrDbe5R", "OIDC client secret") OIDCConfig OIDCConfigI OIDCVerifier OIDCVerifierI GetOIDCClaims = parseClaims )
var ( SAMLCert = flag.String("saml-cert-file", "example/myservice.cert", "SAML SP path to cert.pem") SAMLKey = flag.String("saml-key-file", "example/myservice.key", "SAML SP path to key.pem") SAMLID = flag.String("saml-entity-id", "", "SAML SP entity ID (blank defaults to beyond-host)") SAMLIDP = flag.String("saml-metadata-url", "", "SAML metadata URL from IdP (blank disables SAML)") SAMLNIDF = flag.String("saml-nameid-format", "email", "SAML SP option: {email, persistent, transient, unspecified}") SAMLAttr = flag.String("saml-session-key", "email", "SAML attribute to map from session") SAMLSignRequests = flag.Bool("saml-sign-requests", false, "SAML SP signs authentication requests") SAMLSignMethod = flag.String("saml-signature-method", "", "SAML SP option: {sha1, sha256, sha512}") )
var ( CookieAge = flag.Int("cookie-age", 3600*6, "MaxAge setting in seconds") CookieDom = flag.String("cookie-domain", ".myorg.net", "session cookie domain") CookieKey = flag.String("cookie-key", "", "64-char hex key for cookie authentication and encryption") CookieKey1 = flag.String("cookie-key1", "", "legacy cookie authentication key; use with -cookie-key2") CookieKey2 = flag.String("cookie-key2", "", "legacy cookie encryption key; use with -cookie-key1") CookieName = flag.String("cookie-name", "beyond", "session cookie name") )
var ( TokenBase = flag.String("token-base", "", "token server URL prefix (eg. https://api.github.com/user)") TokenGQL = flag.String("token-graphql", "", "GraphQL URL for auth (eg. https://api.github.com/graphql)") TokenGQLQ = flag.String("token-graphql-query", `{"query": "query { viewer { login }}"}`, "") )
Functions ¶
func EncodeFederateNext ¶
EncodeFederateNext encodes a next URL for federation
func Federate ¶
func Federate(w http.ResponseWriter, r *http.Request, cookieName string, loginHandler func(http.ResponseWriter, *http.Request))
Federate handles federation requests
func FederateVerify ¶
func FederateVerify(w http.ResponseWriter, r *http.Request)
FederateVerify verifies a federation token
func GetSession ¶
GetSession retrieves a session from the request
func OIDCAuthCodeURL ¶
func OIDCAuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
OIDCAuthCodeURL returns the OIDC authorization URL
func OIDCVerify ¶
OIDCVerify verifies an OIDC authorization code and returns the user email
func OIDCVerifyToken ¶
OIDCVerifyToken verifies an OAuth2 token and extracts the user email
func OIDCVerifyTokenID ¶
OIDCVerifyTokenID verifies an OIDC ID token and extracts the user email
func SAMLFilter ¶
func SAMLFilter(w http.ResponseWriter, r *http.Request, sessionStore SessionStore, cookieName string) (bool, error)
SAMLFilter processes SAML authentication and sets the user session
func SAMLHandleStartAuthFlow ¶
func SAMLHandleStartAuthFlow(w http.ResponseWriter, r *http.Request)
SAMLHandleStartAuthFlow initiates the SAML authentication flow
func SAMLMiddleware ¶
func SAMLMiddleware() *samlsp.Middleware
SAMLMiddleware returns the SAML middleware for handling SAML endpoints
Types ¶
type OIDCClaims ¶
type OIDCClaims struct {
Email string `json:"email"`
}
OIDCClaims represents OIDC token claims
type OIDCConfigI ¶
type OIDCConfigI interface {
AuthCodeURL(string, ...oauth2.AuthCodeOption) string
Exchange(context.Context, string) (*oauth2.Token, error)
}
OIDCConfigI is the interface for OIDC configuration
type OIDCVerifierI ¶
OIDCVerifierI is the interface for OIDC token verification
type Session ¶
type Session struct {
Values map[string]interface{}
// contains filtered or unexported fields
}
Session represents a user session