auth_handler

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(server *server.Server, grp *huma.Group)

Types

type CallbackInput

type CallbackInput struct {
	Code string `query:"code" required:"true"`
}

CallbackInput defines the query parameters for the callback endpoint.

type CallbackResponse

type CallbackResponse struct {
	Body struct {
		AccessToken  string    `json:"access_token"`
		TokenType    string    `json:"token_type"`
		RefreshToken string    `json:"refresh_token"`
		IDToken      string    `json:"id_token"`
		Expiry       time.Time `json:"expiry"`
	}
}

CallbackResponse defines the JSON structure for the response. Huma will automatically encode this as JSON.

type HandlerGroup

type HandlerGroup struct {
	// contains filtered or unexported fields
}

func (*HandlerGroup) Callback

func (self *HandlerGroup) Callback(ctx context.Context, in *CallbackInput) (*CallbackResponse, error)

Callback handles the OAuth2 callback.

func (*HandlerGroup) DevLogin

Login handles the OAuth login redirect.

func (*HandlerGroup) LoginSubmit

func (h *HandlerGroup) LoginSubmit(
	ctx context.Context,
	input *LoginSubmitInput,
) (*LoginSubmitResponse, error)

type LoginForm

type LoginForm struct {
	Username      string `schema:"username"  json:"username"  form:"username"  minLength:"1"`
	Password      string `schema:"password"  json:"password"  form:"password"  minLength:"1"`
	ClientID      string `schema:"client_id" json:"client_id" form:"client_id" minLength:"1"`
	RedirectURI   string `schema:"redirect_uri" json:"redirect_uri" form:"redirect_uri" format:"uri"`
	ResponseType  string `schema:"response_type" json:"response_type" form:"response_type" default:"code"`
	State         string `schema:"state" json:"state" form:"state"`
	Scope         string `schema:"scope" json:"scope" form:"scope"`
	PageKey       string `schema:"page_key" json:"page_key" form:"page_key"`
	InitiatingURL string `schema:"initiating_url" json:"initiating_url" form:"initiating_url"`
}

type LoginSubmitInput

type LoginSubmitInput struct {
	Body LoginForm
}

type LoginSubmitResponse

type LoginSubmitResponse struct {
	Status   int
	Location string `header:"Location"`
}

type OauthLoginResponse

type OauthLoginResponse struct {
	Status int
	Url    string `header:"Location"`
	Cookie string `header:"Set-Cookie"`
}

Jump to

Keyboard shortcuts

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