auth

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubAuth = "github"
	AzureAuth  = "azure"
	GoogleAuth = "google"

	// Users with both a personal Microsoft account and a work or school account from Azure AD can sign in to the application.
	AzureCommonTenant = "common"

	// Only users with work or school accounts from Azure AD can sign in to the application.
	AzureOrganizationsTenant = "organizations"

	// Only users with a personal Microsoft account can sign in to the application.
	AzureConsumersTenant = "consumers"
)

Variables

This section is empty.

Functions

func GetOauthConfig

func GetOauthConfig(authProvider string, orgScope bool) *oauth2.Config

func GetObject

func GetObject(client *http.Client, url string, dst interface{}) error

Types

type GoogleUser

type GoogleUser struct {
	Sub   string `json:"sub"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

type SecurityPrincipal

type SecurityPrincipal struct {
	UID           string    `json:"uid"`
	ID            string    `json:"id"`
	AuthProvider  string    `json:"authProvider"`
	Token         string    `json:"token"`
	Login         string    `json:"login"`
	Name          string    `json:"name"`
	Email         string    `json:"email"`
	Groups        []string  `json:"groups"`
	ClientIP      string    `json:"clientIP"`
	UserAgentHash string    `json:"userAgentHash"`
	Created       time.Time `json:"created,omitempty"`
}

func NewPrincipal

func NewPrincipal(authProvider string, clientIP string, userAgent string, groupsEnabled bool) *SecurityPrincipal

func (*SecurityPrincipal) GetToken

func (p *SecurityPrincipal) GetToken() (*oauth2.Token, error)

func (*SecurityPrincipal) HasPermissions

func (p *SecurityPrincipal) HasPermissions(permissions string) bool

func (*SecurityPrincipal) SetToken

func (p *SecurityPrincipal) SetToken(token *oauth2.Token) error

func (*SecurityPrincipal) Signout

func (p *SecurityPrincipal) Signout() error

func (*SecurityPrincipal) UpdateDetails

func (p *SecurityPrincipal) UpdateDetails() error

type SigninOptions

type SigninOptions struct {
	GitHubEnabled    bool `json:"gitHubEnabled"`
	GitHubGroupScope bool `json:"gitHubGroupScope"`
	AzureEnabled     bool `json:"azureEnabled"`
	AzureGroupScope  bool `json:"azureGroupScope"`
	GoogleEnabled    bool `json:"googleEnabled"`
	GoogleGroupScope bool `json:"googleGroupScope"`
}

func GetSigninOptions

func GetSigninOptions(permissions string) *SigninOptions

type State

type State struct {
	Id                string `json:"id"`
	RedirectURL       string `json:"redirectUrl"`
	AuthProvider      string `json:"authProvider"`
	GroupsEnabled     bool   `json:"groupsEnabled"`
	PersistAuthCookie bool   `json:"persistAuthCookie"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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