auth

package
v0.0.0-...-f2fa0db Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHostName

func ExtractHostName(ctx context.Context) (string, error)

ExtractHostName try to extract hostname from context

func ExtractToken

func ExtractToken(ctx context.Context) (string, error)

ExtractToken try to extract token from context

func ExtractUser

func ExtractUser(ctx context.Context) (*auth.User, error)

ExtractUser try to extract the current user from the context

func InitMiddleware

func InitMiddleware(userService users.Service)

func InitRbac

func InitRbac(ctx context.Context, rulesSrv rules.Service, usersSrv users.Service, ps *pubsub.PubSub) (*rbacService, error)

func ValidateLoginRequest

func ValidateLoginRequest(c *auth.LoginRequest) error

ValidateLoginRequest validates the LoginRequest fields.

func ValidateRegisterRequest

func ValidateRegisterRequest(c *auth.RegisterRequest) error

ValidateRegisterRequest validates the RegisterRequest fields.

Types

type API

type API interface {
	grpcgw.Controller
}

API RBAC service api

func New

func New(ctx context.Context, srv Service, rulesService rules.Service, userService users.Service) (API, error)

New create an RBAC api service

type Group

type Group struct {
	Subject string
	Role    string
	Domain  string
}

type Headers

type Headers struct {
	ForwardedHost   string
	ForwardedURI    string
	ForwardedMethod string
}

type Middleware

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

type Policy

type Policy struct {
	Subject  string
	Domain   string
	Resource string
	Action   string
	Object   string
	Effect   string
}

type Service

Service encapsulates use case logic for auth.

func NewService

func NewService(userService users.Service, rbac *rbacService) Service

NewService creates a new auth service.

Jump to

Keyboard shortcuts

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