idclient

package
v0.0.0-...-831b668 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Function61 = "https://function61.com/id" // our ID server
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer func(*http.Request, *httpauth.UserDetails) bool

func UserListAuthorizer

func UserListAuthorizer(authorizedUserIds ...string) Authorizer

type Client

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

func New

func New(serverBaseurl string) *Client

func (*Client) CreateAuthGateway

func (c *Client) CreateAuthGateway(router *mux.Router, audience string) *GatewayApi

func (*Client) ObtainPublicKey

func (c *Client) ObtainPublicKey(ctx context.Context) (ed25519.PublicKey, error)

func (*Client) UserByToken

func (c *Client) UserByToken(ctx context.Context, token string) (*idtypes.User, error)

type GatewayApi

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

func (*GatewayApi) AuthenticateAndAuthorize

func (g *GatewayApi) AuthenticateAndAuthorize(
	w http.ResponseWriter,
	r *http.Request,
	authorizer Authorizer,
) *httpauth.UserDetails

returns UserDetails if user is authenticated & authorized. if returns nil, error response was already sent.

func (*GatewayApi) LogoutUrl

func (g *GatewayApi) LogoutUrl() string

func (*GatewayApi) Protect

func (g *GatewayApi) Protect(authorizer Authorizer, authorizedHandler http.Handler) http.Handler

wraps inner Handler with protection: 1) authentication 2) authorization

Jump to

Keyboard shortcuts

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