*: update handlers to include issuer url in path
This commit is contained in:
parent
1e0ee1e435
commit
854b767273
3 changed files with 23 additions and 17 deletions
|
@ -214,41 +214,47 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||||
|
|
||||||
clock := clockwork.NewRealClock()
|
clock := clockwork.NewRealClock()
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc(httpPathDiscovery, handleDiscoveryFunc(s.ProviderConfig()))
|
handle := func(urlPath string, h http.Handler) {
|
||||||
mux.HandleFunc(httpPathAuth, handleAuthFunc(s, s.Connectors, s.LoginTemplate, s.EnableRegistration))
|
mux.Handle(path.Join(s.IssuerURL.Path, urlPath), h)
|
||||||
mux.HandleFunc(httpPathOOB, handleOOBFunc(s, s.OOBTemplate))
|
}
|
||||||
mux.HandleFunc(httpPathToken, handleTokenFunc(s))
|
handleFunc := func(urlPath string, hf http.HandlerFunc) {
|
||||||
mux.HandleFunc(httpPathKeys, handleKeysFunc(s.KeyManager, clock))
|
handle(urlPath, hf)
|
||||||
mux.Handle(httpPathHealth, makeHealthHandler(checks))
|
}
|
||||||
|
handleFunc(httpPathDiscovery, handleDiscoveryFunc(s.ProviderConfig()))
|
||||||
|
handleFunc(httpPathAuth, handleAuthFunc(s, s.Connectors, s.LoginTemplate, s.EnableRegistration))
|
||||||
|
handleFunc(httpPathOOB, handleOOBFunc(s, s.OOBTemplate))
|
||||||
|
handleFunc(httpPathToken, handleTokenFunc(s))
|
||||||
|
handleFunc(httpPathKeys, handleKeysFunc(s.KeyManager, clock))
|
||||||
|
handle(httpPathHealth, makeHealthHandler(checks))
|
||||||
|
|
||||||
if s.EnableRegistration {
|
if s.EnableRegistration {
|
||||||
mux.HandleFunc(httpPathRegister, handleRegisterFunc(s, s.RegisterTemplate))
|
handleFunc(httpPathRegister, handleRegisterFunc(s, s.RegisterTemplate))
|
||||||
}
|
}
|
||||||
|
|
||||||
mux.HandleFunc(httpPathEmailVerify, handleEmailVerifyFunc(s.VerifyEmailTemplate,
|
handleFunc(httpPathEmailVerify, handleEmailVerifyFunc(s.VerifyEmailTemplate,
|
||||||
s.IssuerURL, s.KeyManager.PublicKeys, s.UserManager))
|
s.IssuerURL, s.KeyManager.PublicKeys, s.UserManager))
|
||||||
|
|
||||||
mux.Handle(httpPathVerifyEmailResend, s.NewClientTokenAuthHandler(handleVerifyEmailResendFunc(s.IssuerURL,
|
handle(httpPathVerifyEmailResend, s.NewClientTokenAuthHandler(handleVerifyEmailResendFunc(s.IssuerURL,
|
||||||
s.KeyManager.PublicKeys,
|
s.KeyManager.PublicKeys,
|
||||||
s.UserEmailer,
|
s.UserEmailer,
|
||||||
s.UserRepo,
|
s.UserRepo,
|
||||||
s.ClientManager)))
|
s.ClientManager)))
|
||||||
|
|
||||||
mux.Handle(httpPathSendResetPassword, &SendResetPasswordEmailHandler{
|
handle(httpPathSendResetPassword, &SendResetPasswordEmailHandler{
|
||||||
tpl: s.SendResetPasswordEmailTemplate,
|
tpl: s.SendResetPasswordEmailTemplate,
|
||||||
emailer: s.UserEmailer,
|
emailer: s.UserEmailer,
|
||||||
sm: s.SessionManager,
|
sm: s.SessionManager,
|
||||||
cm: s.ClientManager,
|
cm: s.ClientManager,
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle(httpPathResetPassword, &ResetPasswordHandler{
|
handle(httpPathResetPassword, &ResetPasswordHandler{
|
||||||
tpl: s.ResetPasswordTemplate,
|
tpl: s.ResetPasswordTemplate,
|
||||||
issuerURL: s.IssuerURL,
|
issuerURL: s.IssuerURL,
|
||||||
um: s.UserManager,
|
um: s.UserManager,
|
||||||
keysFunc: s.KeyManager.PublicKeys,
|
keysFunc: s.KeyManager.PublicKeys,
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle(httpPathAcceptInvitation, &InvitationHandler{
|
handle(httpPathAcceptInvitation, &InvitationHandler{
|
||||||
passwordResetURL: s.absURL(httpPathResetPassword),
|
passwordResetURL: s.absURL(httpPathResetPassword),
|
||||||
issuerURL: s.IssuerURL,
|
issuerURL: s.IssuerURL,
|
||||||
um: s.UserManager,
|
um: s.UserManager,
|
||||||
|
@ -258,10 +264,10 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||||
})
|
})
|
||||||
|
|
||||||
if s.EnableClientRegistration {
|
if s.EnableClientRegistration {
|
||||||
mux.HandleFunc(httpPathClientRegistration, s.handleClientRegistration)
|
handleFunc(httpPathClientRegistration, s.handleClientRegistration)
|
||||||
}
|
}
|
||||||
|
|
||||||
mux.HandleFunc(httpPathDebugVars, health.ExpvarHandler)
|
handleFunc(httpPathDebugVars, health.ExpvarHandler)
|
||||||
|
|
||||||
pcfg := s.ProviderConfig()
|
pcfg := s.ProviderConfig()
|
||||||
for _, idpc := range s.Connectors {
|
for _, idpc := range s.Connectors {
|
||||||
|
@ -280,7 +286,7 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||||
usersAPI := usersapi.NewUsersAPI(s.UserManager, s.ClientManager, s.RefreshTokenRepo, s.UserEmailer, s.localConnectorID)
|
usersAPI := usersapi.NewUsersAPI(s.UserManager, s.ClientManager, s.RefreshTokenRepo, s.UserEmailer, s.localConnectorID)
|
||||||
handler := NewUserMgmtServer(usersAPI, s.JWTVerifierFactory(), s.UserManager, s.ClientManager).HTTPHandler()
|
handler := NewUserMgmtServer(usersAPI, s.JWTVerifierFactory(), s.UserManager, s.ClientManager).HTTPHandler()
|
||||||
|
|
||||||
mux.Handle(apiBasePath+"/", handler)
|
handle(apiBasePath+"/", handler)
|
||||||
|
|
||||||
return http.Handler(mux)
|
return http.Handler(mux)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2 class="heading">Log in to Your Account</h2>
|
<h2 class="heading">Log in to Your Account</h2>
|
||||||
<form method="post" action="{{.PostURL | absPath }}">
|
<form method="post" action="{{ .PostURL }}">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
LDAP
|
LDAP
|
||||||
<div class="input-desc">
|
<div class="input-desc">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2 class="heading">Log in to Your Account</h2>
|
<h2 class="heading">Log in to Your Account</h2>
|
||||||
<form method="post" action="{{.PostURL | absPath}}">
|
<form method="post" action="{{ .PostURL }}">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="input-desc">
|
<div class="input-desc">
|
||||||
<label for="userid">Email Address</label>
|
<label for="userid">Email Address</label>
|
||||||
|
|
Reference in a new issue