auth

package
v2.56.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AuthorizationExtrasHeader = "authorization-extras"
)

Variables

This section is empty.

Functions

func SessionExpiresAt added in v2.55.0

func SessionExpiresAt(c echo.Context, maxSessionDuration time.Duration) time.Time

SessionExpiresAt reports when the session recorded by the session_start cookie reaches maxSessionDuration. It returns the zero time when no max duration is configured, or when the cookie is missing or unreadable.

func SetSessionStart added in v2.45.2

func SetSessionStart(c echo.Context, maxSessionDuration time.Duration, secure bool)

SetSessionStart sets a cookie with the current timestamp to track when the session began. This should only be called on initial login, NOT on token refresh.

func SetUser

func SetUser(c echo.Context, user *User, opts CookieOptions) error

func SetVerifier added in v2.45.2

func SetVerifier(v *oidc.IDTokenVerifier)

func ValidateAuthHeaderExists added in v2.16.0

func ValidateAuthHeaderExists(c echo.Context, cfgProvider *config.ConfigProviderWithRefresh) error

ValidateAuthHeaderExists validates that the autorization header exists if auth is enabled. User autorization should be done in the frontend by claim-mapper and authorizer plugins. See https://docs.temporal.io/security#authentication

func ValidateSessionDuration added in v2.45.2

func ValidateSessionDuration(c echo.Context, maxSessionDuration time.Duration) error

ValidateSessionDuration checks if the session has exceeded the configured max duration.

Types

type Claims

type Claims struct {
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
}

type CookieOptions added in v2.55.0

type CookieOptions struct {
	// Secure marks the cookies Secure.
	Secure bool
	// SessionExpiresAt is when the current session reaches the configured
	// maxSessionDuration. The zero value means no max duration is configured.
	SessionExpiresAt time.Time
	// RefreshTokenDuration is the provider's configured refresh token lifetime.
	// Zero means unset.
	RefreshTokenDuration time.Duration
}

CookieOptions carries the deployment settings that decide how the auth cookies are written.

type IDToken added in v2.2.0

type IDToken struct {
	RawToken string
	Claims   *Claims
}

type User

type User struct {
	OAuth2Token *oauth2.Token
	IDToken     *IDToken
}

func ExchangeCode

func ExchangeCode(ctx context.Context, r *http.Request, config *oauth2.Config, provider *oidc.Provider) (*User, error)

type UserResponse added in v2.7.0

type UserResponse struct {
	AccessToken string
	IDToken     string
	Name        string
	Email       string
	Picture     string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL