samlsession

package
v0.0.0-...-627ecdb Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(StoreRedis), "*"),
	wire.Struct(new(UIService), "*"),
)
View Source
var ErrNotFound = errors.New("saml session entry not found")

Functions

This section is empty.

Types

type SAMLSession

type SAMLSession struct {
	ID     string            `json:"id,omitempty"`
	Entry  *SAMLSessionEntry `json:"entry,omitempty"`
	UIInfo *SAMLUIInfo       `json:"ui_info,omitempty"`
}

func NewSAMLSession

func NewSAMLSession(entry *SAMLSessionEntry, uiInfo *SAMLUIInfo) *SAMLSession

type SAMLSessionEntry

type SAMLSessionEntry struct {
	ServiceProviderID string `json:"service_provider_id,omitempty"`
	AuthnRequestXML   string `json:"authn_request_xml,omitempty"`
	// The url the response should send to
	CallbackURL string `json:"callback_url,omitempty"`
	RelayState  string `json:"relay_state,omitempty"`
}

func (*SAMLSessionEntry) AuthnRequest

func (s *SAMLSessionEntry) AuthnRequest() (*samlprotocol.AuthnRequest, bool)

type SAMLUIInfo

type SAMLUIInfo struct {
	// SAMLServiceProviderID is id of the service provider, and also the corresponding client_id
	SAMLServiceProviderID string
	// RedirectURI is the redirect_uri the UI should redirect to.
	// The redirect_uri in the URL has lower precedence.
	// The rationale for this is if the end-user bookmarked the
	// authorization URL in the browser, redirect to the app is
	// possible.
	RedirectURI string
	// Prompt is the resolved oidc prompt from ForceAuthn and IsPassive for AuthnRequest.
	Prompt []string

	// login_hint resolved from <Subject>
	LoginHint string
}

func (*SAMLUIInfo) ToUIParam

func (i *SAMLUIInfo) ToUIParam() uiparam.T

type StoreRedis

type StoreRedis struct {
	Redis *appredis.Handle
	AppID config.AppID
}

func (*StoreRedis) Delete

func (s *StoreRedis) Delete(ctx context.Context, sessionID string) (err error)

func (*StoreRedis) Get

func (s *StoreRedis) Get(ctx context.Context, sessionID string) (entry *SAMLSession, err error)

func (*StoreRedis) Save

func (s *StoreRedis) Save(ctx context.Context, session *SAMLSession) (err error)

type UIService

type UIService struct {
	Endpoints UIServiceAuthUIEndpointsProvider
}

func (*UIService) BuildAuthenticationURL

func (s *UIService) BuildAuthenticationURL(session *SAMLSession) (*url.URL, error)

func (*UIService) GetSAMLSessionID

func (r *UIService) GetSAMLSessionID(req *http.Request, urlQuery string) (string, bool)

func (*UIService) RemoveSAMLSessionID

func (r *UIService) RemoveSAMLSessionID(w http.ResponseWriter, req *http.Request)

func (*UIService) ResolveUIInfo

func (r *UIService) ResolveUIInfo(sp *config.SAMLServiceProviderConfig, entry *SAMLSessionEntry) (
	info *SAMLUIInfo, showUI bool, err error)

type UIServiceAuthUIEndpointsProvider

type UIServiceAuthUIEndpointsProvider interface {
	OAuthEntrypointURL() *url.URL
	SAMLLoginFinishURL() *url.URL
}

Jump to

Keyboard shortcuts

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