auth

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package auth provides functionality related to authentication and authorization

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient(ctx context.Context, config ServiceConfiguration) (*authservice.Client, error)

func GetEntitlement

func GetEntitlement(ctx context.Context, entitlementEndpoint string, entitlementResource *EntitlementResource, userAccesToken string) (*string, error)

GetEntitlement obtains Entitlement for specific resource. If entitlementResource == nil then Entitlement for all resources available to the user is returned. Returns (nil, nil) if response status == Forbiden which means the user doesn't have permissions to obtain Entitlement

Types

type AuthzResourceManager

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

AuthzResourceManager implements ResourceManager interface

func NewAuthzResourceManager

func NewAuthzResourceManager(config ServiceConfiguration) *AuthzResourceManager

NewAuthzResourceManager constructs AuthzResourceManager

func (*AuthzResourceManager) CreateSpace

func (m *AuthzResourceManager) CreateSpace(ctx context.Context, request *http.Request, spaceID string) error

CreateSpace calls auth service to create a keycloak resource associated with the space

func (*AuthzResourceManager) DeleteSpace

func (m *AuthzResourceManager) DeleteSpace(ctx context.Context, request *http.Request, spaceID string) error

DeleteSpace calls auth service to delete the keycloak resource associated with the space

type EntitlementMeta

type EntitlementMeta struct {
	Limit string `json:"limit"`
}

type EntitlementResource

type EntitlementResource struct {
	Permissions     []ResourceSet   `json:"permissions"`
	MetaInformation EntitlementMeta `json:"metadata"`
}

EntitlementResource represents a payload for obtaining entitlement for specific resource

type ResourceManager

type ResourceManager interface {
	CreateSpace(ctx context.Context, request *http.Request, spaceID string) error
	DeleteSpace(ctx context.Context, request *http.Request, spaceID string) error
}

ResourceManager represents a space resource manager

type ResourceSet

type ResourceSet struct {
	Name string  `json:"resource_set_name"`
	ID   *string `json:"resource_set_id,omitempty"`
}

ResourceSet represents a resource set for Entitlement payload

type ServiceConfiguration

type ServiceConfiguration interface {
	GetAuthServiceURL() string
	GetAuthShortServiceHostName() string
	IsAuthorizationEnabled() bool
}

ServiceConfiguration represents auth service configuration

Jump to

Keyboard shortcuts

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