auth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFunc

func AuthFunc(userSvc *user.Service, provider fosite.OAuth2Provider, getKey func() *rsa.PublicKey) grpc_auth.AuthFunc

Types

type Config

type Config struct {
	AccessTokenLifespan  time.Duration `yaml:"accessTokenLifespan"`
	RefreshTokenLifespan time.Duration `yaml:"refreshTokenLifespan"`
	ClientID             string        `yaml:"clientID"`
	Issuer               string        `yaml:"issuer"`
}

type LoginResp

type LoginResp struct {
	Token       string
	User        user.User
	Permissions map[string][]string
}

type Server

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

func NewServer

func NewServer(config Config, userSvc *user.Service) (*Server, error)

func (*Server) AuthEndpoint

func (s *Server) AuthEndpoint(rw http.ResponseWriter, req *http.Request)

func (*Server) GetPublicKey

func (s *Server) GetPublicKey() *rsa.PublicKey

func (*Server) IntrospectionEndpoint

func (s *Server) IntrospectionEndpoint(rw http.ResponseWriter, req *http.Request)

func (*Server) Login

func (s *Server) Login(ctx context.Context, username, password string) (*LoginResp, error)

func (*Server) Logout

func (s *Server) Logout(ctx context.Context) error

func (*Server) Provider

func (s *Server) Provider() fosite.OAuth2Provider

func (*Server) RevokeEndpoint

func (s *Server) RevokeEndpoint(rw http.ResponseWriter, req *http.Request)

func (*Server) TokenEndpoint

func (s *Server) TokenEndpoint(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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