auth

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// rfc2617 (e.g. Authorization: basic token, Authorization: bearer token)
	AuthorizationHeader = "authorization"
	Basic               = "basic"
	Bearer              = "bearer"
)
View Source
const (
	UserCtxName = "user"
)

Variables

This section is empty.

Functions

func JWTAuthHeaderForGRPC

func JWTAuthHeaderForGRPC(jwtToken string) metadata.MD

JWTAuthHeaderForGRPC returns JWT Auth Header for GRPC.

Types

type AwsIamConfig

type AwsIamConfig struct {
	ClientAccessKey       string
	ClientSecretAccessKey string

	ServerAllowUsers []string // allow users
	ServerAccountId  string   // server allow users
}

func (*AwsIamConfig) ClientAuth added in v1.3.0

func (c *AwsIamConfig) ClientAuth() (ClientAuthMethod, bool)

ClientAuth is returns ClientAuthMethod for AWS IAM.

func (*AwsIamConfig) ServerAuth added in v1.3.0

func (c *AwsIamConfig) ServerAuth() (ServerAuthMethod, bool)

ServerAuth returns ServerAuthMethod and bool value(whether exist or not).

type ClientAuthMethod

type ClientAuthMethod func(conn protocol.VPNClient) (jwt string, err error)

type ClientManager added in v1.3.0

type ClientManager interface {
	ClientAuth() (ClientAuthMethod, bool)
}

func NewClientManagerForAwsIAM added in v1.3.0

func NewClientManagerForAwsIAM(accessKey, accessSecret string) (ClientManager, error)

NewClientManagerForAwsIAM returns ClientManager implementing awsIam.

func NewClientManagerForGoogleOpenID added in v1.3.0

func NewClientManagerForGoogleOpenID(clientId, clientSecret string) (ClientManager, error)

NewClientManagerForGoogleOpenID returns ClientManager implementing googleOpenId.

func NewClientManagerForTest added in v1.3.0

func NewClientManagerForTest() (ClientManager, error)

NewClientManagerForTest returns ClientManager implementing googleOpenId.

type GoogleOpenIDConfig

type GoogleOpenIDConfig struct {
	ClientId     string // google client id
	ClientSecret string // google secret

	HD          string   // gsuite domain (only vpn-server)
	AllowEmails []string // allow emails (only vpn-server)
}

https://developers.google.com/identity/protocols/oauth2/native-app https://developers.google.com/identity/protocols/oauth2/openid-connect

func (*GoogleOpenIDConfig) ClientAuth added in v1.3.0

func (c *GoogleOpenIDConfig) ClientAuth() (ClientAuthMethod, bool)

ClientAuth is returns ClientAuthMethod for Google Open ID.

func (*GoogleOpenIDConfig) ServerAuth added in v1.3.0

func (c *GoogleOpenIDConfig) ServerAuth() (ServerAuthMethod, bool)

ServerAuth returns ServerAuthMethod and bool value(whether exist or not).

type ServerAuthMethod added in v1.3.0

type ServerAuthMethod grpc.UnaryServerInterceptor

type ServerManager added in v1.3.0

type ServerManager interface {
	ServerAuth() (ServerAuthMethod, bool)
}

func NewServerManagerForAwsIAM added in v1.3.0

func NewServerManagerForAwsIAM(accountId string, allowUsers []string) (ServerManager, error)

NewServerManagerForAwsIAM returns ServerManager implementing awsIam.

func NewServerManagerForGoogleOpenID added in v1.3.0

func NewServerManagerForGoogleOpenID(clientId, clientSecret, hd string, allowEmails []string) (ServerManager, error)

NewServerManagerForGoogleOpenID returns ServerManager implementing googleOpenI

func NewServerManagerForTest added in v1.3.0

func NewServerManagerForTest() (ServerManager, error)

NewServerManagerForTest returns ServerManager implementing googleOpenI

Jump to

Keyboard shortcuts

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