crowdauth

package
v0.0.0-...-9c6f178 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package crowdauth provides middleware for Crowd SSO logins

Goals:

  1. drop-in authentication against Crowd SSO
  2. make it easy to use Crowd SSO as part of your own auth flow

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClientAddressFinder

func DefaultClientAddressFinder(r *http.Request) (addr string, err error)

Types

type AuthLoginPage

type AuthLoginPage func(http.ResponseWriter, *http.Request, *SSO) bool

The AuthLoginPage type extends the normal http.HandlerFunc type with a boolean return to indicate login success or failure.

type ClientAddressFinder

type ClientAddressFinder func(*http.Request) (string, error)

ClientAddressFinder type represents a function that returns the end-user's IP address, allowing you to handle cases where the address is masked by proxy servers etc by checking headers or whatever to find the user's address

type SSO

type SSO struct {
	CrowdApp            *crowd.Crowd
	LoginPage           AuthLoginPage
	LoginTemplate       *template.Template
	ClientAddressFinder ClientAddressFinder
	CookieConfig        crowd.CookieConfig
}

func New

func New(user string, password string, crowdURL string) (s *SSO, err error)

New creates a new instance of SSO

func (*SSO) EndSession

func (s *SSO) EndSession(w http.ResponseWriter, r *http.Request)

EndSession invalidates the current Crowd session and cookie

func (*SSO) GetUser

func (s *SSO) GetUser(r *http.Request) (u crowd.User, err error)

Get User information for the current session (by cookie)

func (*SSO) Handler

func (s *SSO) Handler(h http.Handler) http.Handler

Handler provides HTTP middleware using http.Handler chaining that requires user authentication via Atlassian Crowd SSO.

func (*SSO) Login

func (s *SSO) Login(user string, pass string, addr string) (cs crowd.Session, err error)

func (*SSO) Logout

func (s *SSO) Logout(w http.ResponseWriter, r *http.Request, newURL string)

func (*SSO) StartSession

func (s *SSO) StartSession(w http.ResponseWriter, cs crowd.Session)

StartSession sets a Crowd session cookie.

Jump to

Keyboard shortcuts

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