fix: Externallogin on existing session (#990)

* fix: existing session with external login

* fix: existing session with external login

* fix: return in login
This commit is contained in:
Fabi 2020-11-20 09:00:49 +01:00 committed by GitHub
parent 85d2be2e8c
commit 7c6fd2b51e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -76,7 +76,9 @@ func (u *UserSession) Reduce(event *models.Event) (err error) {
es_model.HumanMFAOTPRemoved,
es_model.HumanProfileChanged,
es_model.DomainClaimed,
es_model.UserUserNameChanged:
es_model.UserUserNameChanged,
es_model.HumanExternalIDPRemoved,
es_model.HumanExternalIDPCascadeRemoved:
sessions, err := u.view.UserSessionsByUserID(event.AggregateID)
if err != nil {
return err

View File

@ -45,6 +45,7 @@ func (l *Login) handleExternalLoginStep(w http.ResponseWriter, r *http.Request,
for _, idp := range authReq.AllowedExternalIDPs {
if idp.IDPConfigID == selectedIDPConfigID {
l.handleIDP(w, r, authReq, selectedIDPConfigID)
return
}
}
l.renderLogin(w, r, authReq, errors.ThrowInvalidArgument(nil, "VIEW-Fsj7f", "Errors.User.ExternalIDP.NotAllowed"))

View File

@ -116,5 +116,8 @@ func (v *UserSessionView) AppendEvent(event *models.Event) {
v.SecondFactorVerification = time.Time{}
v.ExternalLoginVerification = time.Time{}
v.State = int32(req_model.UserSessionStateTerminated)
case es_model.HumanExternalIDPRemoved, es_model.HumanExternalIDPCascadeRemoved:
v.ExternalLoginVerification = time.Time{}
v.SelectedIDPConfigID = ""
}
}