identp

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package identp is an implementation of [Login and Consent Flow](https://www.ory.sh/docs/hydra/oauth2) between ORY Hydra and Werther Identity Provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HydraURL    string            `envconfig:"hydra_url" required:"true" desc:"an admin URL of ORY Hydra Server"`
	SessionTTL  time.Duration     `envconfig:"session_ttl" default:"24h" desc:"a user session's TTL"`
	ClaimScopes map[string]string `` /* 246-byte string literal not displayed */
}

Config is a Hydra configuration.

type Handler

type Handler struct {
	Config
	// contains filtered or unexported fields
}

Handler provides HTTP handlers that implement [Login and Consent Flow](https://www.ory.sh/docs/hydra/oauth2) between ORY Hydra and Werther Identity Provider.

func NewHandler

func NewHandler(cnf Config, um UserManager, tr TemplateRenderer) *Handler

NewHandler creates a new Handler.

The template's renderer must be able to render a template with name "login.tmpl". The template is a template of the login page. It receives struct LoginTmplData as template's data.

func (*Handler) AddRoutes

func (h *Handler) AddRoutes(apply func(m, p string, h http.Handler, mws ...func(http.Handler) http.Handler))

AddRoutes registers all required routes for Login & Consent Provider.

type LoginTmplData

type LoginTmplData struct {
	CSRFToken            string
	Challenge            string
	LoginURL             string
	IsInvalidCredentials bool
	IsInternalError      bool
}

LoginTmplData is a data that is needed for rendering the login page.

type TemplateRenderer

type TemplateRenderer interface {
	RenderTemplate(w http.ResponseWriter, r *http.Request, name string, data interface{}) error
}

TemplateRenderer renders a template with data and writes it to a http.ResponseWriter.

type UserManager

type UserManager interface {
	// contains filtered or unexported methods
}

UserManager is an interface that is used for authentication and providing user's claims.

Jump to

Keyboard shortcuts

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