providers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2018 License: MPL-2.0 Imports: 37 Imported by: 0

Documentation

Overview

package providers is a catch-all for all TAP auth provider types (e.g. social, active directory), if you are

extending TAP to use more providers, add them to this section

package providers is a catch-all for all TAP auth provider types (e.g. social, active directory), if you are

extending TAP to use more providers, add them to this section

package providers is a catch-all for all TAP auth provider types (e.g. social, active directory), if you are

extending TAP to use more providers, add them to this section

Index

Constants

This section is empty.

Variables

View Source
var ADProviderLogTag = "[AD AUTH]"

ADProviderLogTag is the log tag for the active directory provider

View Source
var ProxyLogTag = "[PROXY PROVIDER] "
View Source
var SocialLogTag = "[SOCIAL AUTH]"

SocialLogTag is the log tag for the social provider

Functions

func ExtractBAUsernameAndPasswordFromRequest

func ExtractBAUsernameAndPasswordFromRequest(r *http.Request) (string, string)

func IsSlugAscii

func IsSlugAscii(s string) bool

IsSlugAscii returns true only if SlugAscii(s) == s.

func RandStringRunes

func RandStringRunes(n int) string

func Slug

func Slug(s string) string

Slug replaces each run of characters which are not unicode letters or numbers with a single hyphen, except for leading or trailing runs. Letters will be stripped of diacritical marks and lowercased. Letter or number codepoints that do not have combining marks or a lower-cased variant will be passed through unaltered.

func SlugAscii

func SlugAscii(s string) string

SlugAscii is identical to Slug, except that runs of one or more unicode letters or numbers that still fall outside the ASCII range will have their UTF-8 representation hex encoded and delimited by hyphens. As with Slug, in no case will hyphens appear at either end of the returned string.

Types

type ADConfig

type ADConfig struct {
	LDAPUseSSL          bool
	LDAPServer          string
	LDAPPort            string
	LDAPUserDN          string
	LDAPBaseDN          string
	LDAPFilter          string
	LDAPEmailAttribute  string
	LDAPAttributes      []string
	LDAPSearchScope     int
	FailureRedirect     string
	DefaultDomain       string
	GetAuthFromBAHeader bool
	SlugifyUserName     bool
}

ADConfig is the configuration object for an LDAP connector

type ADProvider

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

ADProvider is an auth delegation provider for LDAP protocol

func (*ADProvider) Handle

func (s *ADProvider) Handle(w http.ResponseWriter, r *http.Request)

Handle is a delegate for the Http Handler used by the generic inbound handler, it will extract the username and password from the request and atempt to bind tot he AD host.

func (*ADProvider) HandleCallback

func (s *ADProvider) HandleCallback(w http.ResponseWriter, r *http.Request, onError func(tag string, errorMsg string, rawErr error, code int, w http.ResponseWriter, r *http.Request))

HandleCallback is not used

func (*ADProvider) Init

func (s *ADProvider) Init(handler tap.IdentityHandler, profile tap.Profile, config []byte) error

Init initialises the handler with it's IdentityHandler (the interface handling actual account SSO on the target) profile - the Profile to use for this request and the specific configuration for the handler as a byte stream. The config is a byte stream as a hack so we do not need to type cast a map[string]interface{} manually from a JSON configuration

func (*ADProvider) Name

func (s *ADProvider) Name() string

Name provides the name of the ID provider

func (*ADProvider) ProviderType

func (s *ADProvider) ProviderType() tap.ProviderType

ProviderType returns the type of the provider, can be PASSTHROUGH_PROVIDER or REDIRECT dependin on the auth process LDAP is a pass -through provider, it will take authentication variables such as username and password and authenticate directly with the LDAP server with those values instead of delegating to a third-party such as OAuth.

func (*ADProvider) UseCallback

func (s *ADProvider) UseCallback() bool

UseCallback signals whether this provider uses the callback endpoints

type GothConfig

type GothConfig struct {
	UseProviders    []GothProviderConfig
	CallbackBaseURL string
	FailureRedirect string
}

GothConfig is the main configuration object for the Social provider

type GothProviderConfig

type GothProviderConfig struct {
	Name                            string
	Key                             string
	Secret                          string
	DiscoverURL                     string
	DisableAuthHeaderProviderDomain string
}

GothProviderConfig the configurations required for the individual goth providers

type ProxyHandlerConfig

type ProxyHandlerConfig struct {
	TargetHost                         string
	OKCode                             int
	OKResponse                         string
	OKRegex                            string
	ResponseIsJson                     bool
	AccessTokenField                   string
	UsernameField                      string
	ExrtactUserNameFromBasicAuthHeader bool
}

type ProxyProvider

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

func (*ProxyProvider) Handle

func (p *ProxyProvider) Handle(rw http.ResponseWriter, r *http.Request)

func (*ProxyProvider) HandleCallback

func (p *ProxyProvider) HandleCallback(http.ResponseWriter, *http.Request, func(tag string, errorMsg string, rawErr error, code int, w http.ResponseWriter, r *http.Request))

func (*ProxyProvider) Init

func (p *ProxyProvider) Init(handler tap.IdentityHandler, profile tap.Profile, config []byte) error

func (*ProxyProvider) Name

func (p *ProxyProvider) Name() string

func (*ProxyProvider) ProviderType

func (p *ProxyProvider) ProviderType() tap.ProviderType

func (*ProxyProvider) UseCallback

func (p *ProxyProvider) UseCallback() bool

type ReverseProxy

type ReverseProxy struct {
	// Director must be a function which modifies
	// the request into a new request to be sent
	// using Transport. Its response is then copied
	// back to the original client unmodified.
	Director func(*http.Request)

	// The transport used to perform proxy requests.
	// If nil, http.DefaultTransport is used.
	Transport http.RoundTripper

	// FlushInterval specifies the flush interval
	// to flush to the client while copying the
	// response body.
	// If zero, no periodic flushing is done.
	FlushInterval time.Duration
}

ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.

func NewSingleHostReverseProxy

func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy

NewSingleHostReverseProxy returns a new ReverseProxy that rewrites URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir.

func (*ReverseProxy) ServeHTTP

func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Social

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

Social is the identity handler for all social auth, it is a wrapper around Goth, and makes use of it's pluggable providers to provide a raft of social OAuth providers as SSO or Login delegates.

func (*Social) Handle

func (s *Social) Handle(w http.ResponseWriter, r *http.Request)

Handle is the main callback delegate for the generic auth flow

func (*Social) HandleCallback

func (s *Social) HandleCallback(w http.ResponseWriter, r *http.Request, onError func(tag string, errorMsg string, rawErr error, code int, w http.ResponseWriter, r *http.Request))

HandleCallback handles the callback from the OAuth provider

func (*Social) Init

func (s *Social) Init(handler tap.IdentityHandler, profile tap.Profile, config []byte) error

Init will configure the social provider for this request.

func (*Social) Name

func (s *Social) Name() string

Name returns the name of the provider

func (*Social) ProviderType

func (s *Social) ProviderType() tap.ProviderType

ProviderType returns the type of the provider, Social makes use of the reirect type, as it redirects the user to multiple locations in the flow

func (*Social) UseCallback

func (s *Social) UseCallback() bool

UseCallback returns whether or not the callback URL is used for this profile. Social uses it.

Jump to

Keyboard shortcuts

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