Documentation ¶
Index ¶
- Constants
- func AddCodeFlowRoutes(r gin.IRouter, auth *OidcAgent)
- func AddDeviceFlowRoutes(r gin.IRouter, auth *OidcAgent)
- func JsonStringToToken(s string) (*oauth2.Token, error)
- func NewCodeFlowRouter(auth *OidcAgent) *gin.Engine
- func NewDeviceFlowRouter(auth *OidcAgent) *gin.Engine
- type IDTokenVerifier
- type OauthConfig
- type OidcAgent
- func (o *OidcAgent) CheckAuth(c *gin.Context)
- func (o *OidcAgent) Claims(c *gin.Context)
- func (o *OidcAgent) CodeFlowProxy(c *gin.Context)
- func (auth *OidcAgent) CookieSessionMiddleware() gin.HandlerFunc
- func (auth *OidcAgent) CorsMiddleware() gin.HandlerFunc
- func (o *OidcAgent) DeviceFlowProxy(c *gin.Context)
- func (o *OidcAgent) DeviceStart(c *gin.Context)
- func (o *OidcAgent) LoginEnd(c *gin.Context)
- func (o *OidcAgent) LoginStart(c *gin.Context)
- func (o *OidcAgent) Logout(c *gin.Context)
- func (o *OidcAgent) LogoutURL(idToken string, redirect string) (*url.URL, error)
- func (a *OidcAgent) OriginVerifier() gin.HandlerFunc
- func (o *OidcAgent) Refresh(c *gin.Context)
- func (o *OidcAgent) UserInfo(c *gin.Context)
- type OpenIDConnectProvider
Constants ¶
const ( TokenKey = "token" IDTokenKey = "id_token" )
Variables ¶
This section is empty.
Functions ¶
func AddCodeFlowRoutes ¶
func AddDeviceFlowRoutes ¶
func NewCodeFlowRouter ¶
func NewDeviceFlowRouter ¶
Types ¶
type IDTokenVerifier ¶
type OauthConfig ¶
type OidcAgent ¶
type OidcAgent struct {
// contains filtered or unexported fields
}
func NewOidcAgent ¶
func (*OidcAgent) CheckAuth ¶
CheckAuth checks if the user is authenticated. @Summary Check Authentication @Description Checks if the user is currently authenticated @Id CheckAuth @Tags Auth @Accept json @Produce json @Success 200 {object} map[string]bool "logged_in status will be returned" @Router /check/auth [get]
func (*OidcAgent) Claims ¶
Claims fetches the claims associated with the user's access token. @Summary Get Access Token Claims @Description Retrieves the claims present in the user's access token. @Id Claims @Tags Auth @Accept json @Produce json @Success 200 {object} map[string]interface{} @Router /web/claims [get]
func (*OidcAgent) CodeFlowProxy ¶
func (*OidcAgent) CookieSessionMiddleware ¶
func (auth *OidcAgent) CookieSessionMiddleware() gin.HandlerFunc
func (*OidcAgent) CorsMiddleware ¶
func (auth *OidcAgent) CorsMiddleware() gin.HandlerFunc
func (*OidcAgent) DeviceFlowProxy ¶
func (*OidcAgent) DeviceStart ¶
DeviceStart initiates the device login process. @Summary Start Login @Description Starts a device login request @Id DeviceStart @Tags Auth @Accept json @Produce json @Success 200 {object} models.DeviceStartResponse @Router /device/login/start [post]
func (*OidcAgent) LoginEnd ¶
LoginEnd completes the OIDC login process. @Summary Completes OIDC Web Login @Description Handles the callback from the OAuth2/OpenID provider and verifies the tokens. @Id WebEnd @Tags Auth @Accepts json @Produce json @Param code query string true "oauth2 code from authorization server" @Param state query string true "state value from the login start request" @Param error query string true "error message if login failed" @Success 302 {string} string "Redirects to the URLs specified in the login start request" @Router /web/login/end [get]
func (*OidcAgent) LoginStart ¶
LoginStart initiates the OIDC login process. @Summary Initiates OIDC Web Login @Description Generates state and nonce, then redirects the user to the OAuth2 authorization URL. @Id WebStart @Tags Auth @Accepts json @Produce json @Param redirect query string true "URL to redirect to if login succeeds" @Param failure query string false "URL to redirect to if login fails (optional)" @Success 302 {string} string "Redirects to the OAuth2 authorization URL" @Router /web/login/start [get]
func (*OidcAgent) Logout ¶
Logout provides the URL to log out the current user. @Summary Generate Logout URL @Description Provides the URL to initiate the logout process for the current user. @Id Logout @Tags Auth @Accept json @Produce json @Param redirect query string true "URL to redirect to after logout" @Success 302 {string} string "Redirects to the OAuth2 logout URL" @Router /web/logout [get]
func (*OidcAgent) OriginVerifier ¶
func (a *OidcAgent) OriginVerifier() gin.HandlerFunc
func (*OidcAgent) Refresh ¶
Refresh updates the user's access token. @Summary Refresh Access Token @Description Obtains and updates a new access token for the user. @Id Refresh @Tags Auth @Accept json @Produce json @Success 204 @Router /web/refresh [post]
func (*OidcAgent) UserInfo ¶
UserInfo retrieves details about the currently authenticated user. @Summary Retrieve Current User Information @Description Fetches and returns information for the user who is currently authenticated. @Id UserInfo @Tags Auth @Accept json @Produce json @Success 200 {object} models.UserInfoResponse @Router /web/user_info [get]