identityHandlers

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MPL-2.0 Imports: 13 Imported by: 1

Documentation

Overview

package identityHandlers provides a collection of handlers for target systems,

these handlers create accounts and sso tokens

package identityHandlers provides a collection of handlers for target systems,

these handlers create accounts and sso tokens

Index

Constants

View Source
const (
	// Enums to identify which target it being used, dashbaord or portal, they are distinct.
	SSOForDashboard ModuleName = "dashboard"
	SSOForPortal    ModuleName = "portal"
	InvalidModule   ModuleName = ""
	DefaultSSOEmail string     = "ssoSession@ssoSession.com"
)

Variables

View Source
var DummyLogTag string = "[DUMMY ID HANDLER]"

Functions

func GetEmail added in v1.1.0

func GetEmail(gUser goth.User, customEmailField string) string

GetEmail returns the email to be used for SSO

func GetGroupId added in v1.1.0

func GetGroupId(gUser goth.User, CustomUserGroupField, DefaultUserGroup string, userGroupMapping map[string]string, userGroupSeparator string) string

func GetUserID added in v1.1.0

func GetUserID(gUser goth.User, CustomUserIDField string) string

Types

type DummyIdentityHandler

type DummyIdentityHandler struct{}

DummyIdentityHandler is a dummy hndler, use for testing

func (DummyIdentityHandler) CompleteIdentityAction

func (d DummyIdentityHandler) CompleteIdentityAction(w http.ResponseWriter, r *http.Request, i interface{}, profile tap.Profile)

CompleteIdentityAction is called when an authenticated callback event is triggered, it should speak to the target system and generate / login the user. In this case it redirects the user to the ReturnURL.

func (DummyIdentityHandler) CreateIdentity

func (d DummyIdentityHandler) CreateIdentity(i interface{}) (string, error)

Dummy method

func (DummyIdentityHandler) Init

func (d DummyIdentityHandler) Init(conf interface{}) error

Init will set up the configuration of the handler

func (DummyIdentityHandler) LoginIdentity

func (d DummyIdentityHandler) LoginIdentity(user string, pass string) (string, error)

Dummy method

type ModuleName

type ModuleName string // To separate out target modules of the dashboard

type OAuthSettings

type OAuthSettings struct {
	APIListenPath string
	RedirectURI   string
	ResponseType  string
	ClientId      string
	Secret        string
	BaseAPIID     string
	NoRedirect    bool
}

OAuthSettings determine the OAuth parameters for the tap.GenerateOAuthTokenForClient action

type SSOAccessData

type SSOAccessData struct {
	ForSection                ModuleName
	OrgID                     string
	EmailAddress              string
	DisplayName               string
	GroupID                   string
	SSOOnlyForRegisteredUsers bool
}

SSOAccessData is the data type used for speaking to the SSO endpoint in the advanced API

type TokenSettings

type TokenSettings struct {
	BaseAPIID string
	Expires   int64
}

type TykIdentityHandler

type TykIdentityHandler struct {
	API   *tyk.TykAPI
	Store tap.AuthRegisterBackend
	// contains filtered or unexported fields
}

TykIdentityHandler provides an interface for generating SSO identities on a tyk node

func (*TykIdentityHandler) CompleteIdentityAction

func (t *TykIdentityHandler) CompleteIdentityAction(w http.ResponseWriter, r *http.Request, i interface{}, profile tap.Profile)

CompleteIdentityAction will log a user into Tyk dashboard or Tyk portal

func (*TykIdentityHandler) CompleteIdentityActionForDashboard

func (t *TykIdentityHandler) CompleteIdentityActionForDashboard(w http.ResponseWriter, r *http.Request, i interface{}, profile tap.Profile)

CompleteIdentityActionForDashboard handles a dashboard identity. No ise is created, only an SSO login session

func (*TykIdentityHandler) CompleteIdentityActionForOAuth

func (t *TykIdentityHandler) CompleteIdentityActionForOAuth(w http.ResponseWriter, r *http.Request, i interface{}, profile tap.Profile)

func (*TykIdentityHandler) CompleteIdentityActionForPortal

func (t *TykIdentityHandler) CompleteIdentityActionForPortal(w http.ResponseWriter, r *http.Request, i interface{}, profile tap.Profile)

CompleteIdentityActionForPortal will generate an identity for a portal user based, so it will AddOrUpdate that user depnding on if they exist or not and validate the login using a one-time nonce.

func (*TykIdentityHandler) CompleteIdentityActionForTokenAuth

func (t *TykIdentityHandler) CompleteIdentityActionForTokenAuth(w http.ResponseWriter, r *http.Request, i interface{}, profile tap.Profile)

func (*TykIdentityHandler) CreateIdentity

func (t *TykIdentityHandler) CreateIdentity(i interface{}) (string, error)

CreateIdentity will generate an SSO token that can be used with the tyk SSO endpoints for dash or portal. Identity is assumed to be a goth.User object as this is what we are stnadardiseing on.

func (*TykIdentityHandler) Init

func (t *TykIdentityHandler) Init(conf interface{}) error

initialise th Tyk handler, the Tyk handler *requires* initialisation with the TykAPI handler global set up in main

Jump to

Keyboard shortcuts

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