openid

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignOrCreateUserToTeams added in v0.24.0

func AssignOrCreateUserToTeams(s *xorm.Session, u *user.User, teamData []*models.OIDCTeam, issuer string) (oidcTeams []int64, err error)

func CleanupSavedOpenIDProviders added in v0.21.0

func CleanupSavedOpenIDProviders()

func CreateOIDCTeam added in v0.24.0

func CreateOIDCTeam(s *xorm.Session, teamData *models.OIDCTeam, u *user.User, issuer string) (team *models.Team, err error)

func GetOrCreateTeamsByOIDC added in v0.24.0

func GetOrCreateTeamsByOIDC(s *xorm.Session, teamData []*models.OIDCTeam, u *user.User, issuer string) (te []*models.Team, err error)

GetOrCreateTeamsByOIDC returns a slice of teams which were generated from the oidc data. If a team did not exist previously it is automatically created.

func HandleCallback

func HandleCallback(c echo.Context) error

HandleCallback handles the auth request callback after redirecting from the provider with an auth code @Summary Authenticate a user with OpenID Connect @Description After a redirect from the OpenID Connect provider to the frontend has been made with the authentication `code`, this endpoint can be used to obtain a jwt token for that user and thus log them in. @ID get-token-openid @tags auth @Accept json @Produce json @Security JWTKeyAuth @Param callback body openid.Callback true "The openid callback" @Param provider path int true "The OpenID Connect provider key as returned by the /info endpoint" @Success 200 {object} auth.Token @Failure 500 {object} models.Message "Internal error" @Router /auth/openid/{provider}/callback [post]

func RegisterEmptyOpenIDTeamCleanupCron added in v0.24.0

func RegisterEmptyOpenIDTeamCleanupCron()

func RemoveEmptySSOTeams added in v0.24.0

func RemoveEmptySSOTeams(s *xorm.Session) (err error)

func RemoveUserFromTeamsByIDs added in v0.24.0

func RemoveUserFromTeamsByIDs(s *xorm.Session, u *user.User, teamIDs []int64) (err error)

Types

type Callback

type Callback struct {
	Code        string `query:"code" json:"code"`
	Scope       string `query:"scop" json:"scope"`
	RedirectURL string `json:"redirect_url"`
}

Callback contains the callback after an auth request was made and redirected

type Provider

type Provider struct {
	Name            string `json:"name"`
	Key             string `json:"key"`
	OriginalAuthURL string `json:"-"`
	AuthURL         string `json:"auth_url"`
	LogoutURL       string `json:"logout_url"`
	ClientID        string `json:"client_id"`
	Scope           string `json:"scope"`
	ClientSecret    string `json:"-"`

	Oauth2Config *oauth2.Config `json:"-"`
	// contains filtered or unexported fields
}

Provider is the structure of an OpenID Connect provider

func GetAllProviders

func GetAllProviders() (providers []*Provider, err error)

GetAllProviders returns all configured providers

func GetProvider

func GetProvider(key string) (provider *Provider, err error)

GetProvider retrieves a provider from keyvalue

Jump to

Keyboard shortcuts

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