oauth

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 14 Imported by: ? 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 NewAuth

func NewAuth(provider OAuthProvider, config oauth2.Config, skipTlsVerify bool) *auth

NewAuth creates a new auth handler

func NewAuthInterceptor

func NewAuthInterceptor(groups []string) grpc.ServerOption

func RegisterOAuthProvider

func RegisterOAuthProvider(provier OAuthProvider)

Types

type OAuthProvider

type OAuthProvider interface {
	AllScopes() []string
	MinimalScopes() []string
	GetName() string
	GetServer() string
	SetServer(string)
	GetTokenURL() string
	GetAuthURL() string
	GetUserInfoURL() string
}

func GetOAuthProvider

func GetOAuthProvider(name string) OAuthProvider

type UserInfo

type UserInfo struct {
	Sub               string   `json:"sub"`
	Name              string   `json:"name"`
	PreferredUsername string   `json:"preferred_username"`
	Email             string   `json:"email"`
	Picture           string   `json:"picture"`
	Groups            []string `json:"groups"`
}

func GetUser

func GetUser(token string) *UserInfo

func GetUserFromContext

func GetUserFromContext(ctx context.Context) (user *UserInfo)

func GetUserInfo

func GetUserInfo(server OAuthProvider, token string, skipTlsVerify bool) (userInfo *UserInfo, err error)

Jump to

Keyboard shortcuts

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