mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 15:08:51 +00:00
feat: run on a single port (#3163)
* start v2 * start * run * some cleanup * remove v2 pkg again * simplify * webauthn * remove unused config * fix login path in Dockerfile * fix asset_generator.go * health handler * fix grpc web * refactor * merge * build new main.go * run new main.go * update logging pkg * fix error msg * update logging * cleanup * cleanup * go mod tidy * change localDevMode * fix customEndpoints * update logging * comments * change local flag to external configs * fix location generated go code * fix Co-authored-by: fforootd <[email protected]>
This commit is contained in:
co-authored by
fforootd
parent
2f3a482ade
commit
389eb4a27a
@@ -0,0 +1,54 @@
|
||||
package login
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
)
|
||||
|
||||
const (
|
||||
tmplLoginSuccess = "login_success"
|
||||
)
|
||||
|
||||
type loginSuccessData struct {
|
||||
userData
|
||||
RedirectURI string `schema:"redirect-uri"`
|
||||
}
|
||||
|
||||
func (l *Login) redirectToLoginSuccess(w http.ResponseWriter, r *http.Request, id string) {
|
||||
http.Redirect(w, r, l.renderer.pathPrefix+EndpointLoginSuccess+"?authRequestID="+id, http.StatusFound)
|
||||
}
|
||||
|
||||
func (l *Login) handleLoginSuccess(w http.ResponseWriter, r *http.Request) {
|
||||
authRequest, _ := l.getAuthRequest(r)
|
||||
if authRequest == nil {
|
||||
l.renderSuccessAndCallback(w, r, nil, nil)
|
||||
return
|
||||
}
|
||||
for _, step := range authRequest.PossibleSteps {
|
||||
if step.Type() != domain.NextStepLoginSucceeded && step.Type() != domain.NextStepRedirectToCallback {
|
||||
l.renderNextStep(w, r, authRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
l.renderSuccessAndCallback(w, r, authRequest, nil)
|
||||
}
|
||||
|
||||
func (l *Login) renderSuccessAndCallback(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest, err error) {
|
||||
var errID, errMessage string
|
||||
if err != nil {
|
||||
errID, errMessage = l.getErrorMessage(r, err)
|
||||
}
|
||||
data := loginSuccessData{
|
||||
userData: l.getUserData(r, authReq, "Login Successful", errID, errMessage),
|
||||
}
|
||||
if authReq != nil {
|
||||
data.RedirectURI = l.oidcAuthCallbackURL
|
||||
}
|
||||
l.renderer.RenderTemplate(w, r, l.getTranslator(authReq), l.renderer.Templates[tmplLoginSuccess], data, nil)
|
||||
}
|
||||
|
||||
func (l *Login) redirectToCallback(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest) {
|
||||
callback := l.oidcAuthCallbackURL + authReq.ID
|
||||
http.Redirect(w, r, callback, http.StatusFound)
|
||||
}
|
||||
Reference in New Issue
Block a user