auth

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const NameApple string = "apple"
View Source
const NameFacebook string = "facebook"
View Source
const NameGoogle string = "google"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControlManager

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

func NewAccessControlManager

func NewAccessControlManager() *AccessControlManager

func (*AccessControlManager) IsAuthroized

func (a *AccessControlManager) IsAuthroized(role, resource, method string) (bool, error)

func (*AccessControlManager) Register

func (a *AccessControlManager) Register(role, policyPath, confPath string)

func (*AccessControlManager) RegisterAll

func (a *AccessControlManager) RegisterAll(aclConfigs []AclConfig)

type AclConfig

type AclConfig struct {
	Role       string
	PolicyPath string
	ConfPath   string
}

type Apple

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

func NewAppleProvider

func NewAppleProvider() *Apple

func (Apple) AuthUrl

func (b Apple) AuthUrl() string

func (Apple) ClientId

func (b Apple) ClientId() string

func (Apple) ClientSecret

func (b Apple) ClientSecret() string

func (Apple) DisplayName

func (b Apple) DisplayName() string

func (*Apple) FetchAuthUser

func (a *Apple) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

func (Apple) FetchToken

func (b Apple) FetchToken(code string) (*oauth2.Token, error)

func (Apple) RedirectUrl

func (b Apple) RedirectUrl() string

func (Apple) Scopes

func (b Apple) Scopes() []string

func (Apple) SetAuthUrl

func (b Apple) SetAuthUrl(authUrl string)

func (Apple) SetClientId

func (b Apple) SetClientId(clientId string)

func (Apple) SetClientSecret

func (b Apple) SetClientSecret(clientSecret string)

func (Apple) SetDisplayName

func (b Apple) SetDisplayName(displayName string)

func (Apple) SetRedirectUrl

func (b Apple) SetRedirectUrl(redirectUrl string)

func (Apple) SetScopes

func (b Apple) SetScopes(scopes []string)

func (Apple) SetTokenUrl

func (b Apple) SetTokenUrl(tokenUrl string)

func (Apple) SetUserApiUrl

func (b Apple) SetUserApiUrl(userApiUrl string)

func (Apple) TokenUrl

func (b Apple) TokenUrl() string

func (Apple) UserApiUrl

func (b Apple) UserApiUrl() string

type AuthUser

type AuthUser struct {
	Id            string         `json:"id"`
	Name          string         `json:"name"`
	Email         string         `json:"email"`
	EmailVerified bool           `json:"emailVerified"`
	AvatarUrl     string         `json:"avatarUrl"`
	AccessToken   string         `json:"accessToken"`
	RefreshToken  string         `json:"refreshToken"`
	ExpiresAt     types.DateTime `json:"expiresAt"`
	RawUser       map[string]any `json:"rawUser"`
}

func (*AuthUser) ExtractNames

func (a *AuthUser) ExtractNames() (string, string)

type Facebook

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

func NewFacebookProvider

func NewFacebookProvider() *Facebook

func (Facebook) AuthUrl

func (b Facebook) AuthUrl() string

func (Facebook) ClientId

func (b Facebook) ClientId() string

func (Facebook) ClientSecret

func (b Facebook) ClientSecret() string

func (Facebook) DisplayName

func (b Facebook) DisplayName() string

func (*Facebook) FetchAuthUser

func (f *Facebook) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

func (Facebook) FetchToken

func (b Facebook) FetchToken(code string) (*oauth2.Token, error)

func (Facebook) RedirectUrl

func (b Facebook) RedirectUrl() string

func (Facebook) Scopes

func (b Facebook) Scopes() []string

func (Facebook) SetAuthUrl

func (b Facebook) SetAuthUrl(authUrl string)

func (Facebook) SetClientId

func (b Facebook) SetClientId(clientId string)

func (Facebook) SetClientSecret

func (b Facebook) SetClientSecret(clientSecret string)

func (Facebook) SetDisplayName

func (b Facebook) SetDisplayName(displayName string)

func (Facebook) SetRedirectUrl

func (b Facebook) SetRedirectUrl(redirectUrl string)

func (Facebook) SetScopes

func (b Facebook) SetScopes(scopes []string)

func (Facebook) SetTokenUrl

func (b Facebook) SetTokenUrl(tokenUrl string)

func (Facebook) SetUserApiUrl

func (b Facebook) SetUserApiUrl(userApiUrl string)

func (Facebook) TokenUrl

func (b Facebook) TokenUrl() string

func (Facebook) UserApiUrl

func (b Facebook) UserApiUrl() string

type Google

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

func NewGoogleProvider

func NewGoogleProvider() *Google

func (Google) AuthUrl

func (b Google) AuthUrl() string

func (Google) ClientId

func (b Google) ClientId() string

func (Google) ClientSecret

func (b Google) ClientSecret() string

func (Google) DisplayName

func (b Google) DisplayName() string

func (*Google) FetchAuthUser

func (g *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

func (Google) FetchToken

func (b Google) FetchToken(code string) (*oauth2.Token, error)

func (Google) RedirectUrl

func (b Google) RedirectUrl() string

func (Google) Scopes

func (b Google) Scopes() []string

func (Google) SetAuthUrl

func (b Google) SetAuthUrl(authUrl string)

func (Google) SetClientId

func (b Google) SetClientId(clientId string)

func (Google) SetClientSecret

func (b Google) SetClientSecret(clientSecret string)

func (Google) SetDisplayName

func (b Google) SetDisplayName(displayName string)

func (Google) SetRedirectUrl

func (b Google) SetRedirectUrl(redirectUrl string)

func (Google) SetScopes

func (b Google) SetScopes(scopes []string)

func (Google) SetTokenUrl

func (b Google) SetTokenUrl(tokenUrl string)

func (Google) SetUserApiUrl

func (b Google) SetUserApiUrl(userApiUrl string)

func (Google) TokenUrl

func (b Google) TokenUrl() string

func (Google) UserApiUrl

func (b Google) UserApiUrl() string

type Provider

type Provider interface {
	DisplayName() string
	SetDisplayName(displayName string)
	ClientId() string
	SetClientId(clientId string)
	ClientSecret() string
	SetClientSecret(clientSecret string)
	RedirectUrl() string
	SetRedirectUrl(redirectUrl string)
	Scopes() []string
	SetScopes(scopes []string)
	AuthUrl() string
	SetAuthUrl(authUrl string)
	TokenUrl() string
	SetTokenUrl(tokenUrl string)
	FetchToken(code string) (*oauth2.Token, error)
	FetchAuthUser(token *oauth2.Token) (*AuthUser, error)
}

func NewProviderByName

func NewProviderByName(name string) (Provider, error)

Jump to

Keyboard shortcuts

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