feat: jwt as idp (#2363)

* feat: jwt idp

* feat: command side

* feat: add tests

* fill idp views with jwt idps and return apis

* add jwtEndpoint to jwt idp

* begin jwt request handling

* merge

* handle jwt idp

* cleanup

* fixes

* autoregister

* get token from specific header name

* error handling

* fix texts

* handle renderExternalNotFoundOption

Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
This commit is contained in:
Livio Amstutz
2021-09-14 15:15:01 +02:00
committed by GitHub
parent 4e1d42259c
commit b6b5b1b782
54 changed files with 2575 additions and 71 deletions

View File

@@ -17,6 +17,7 @@ type IDPConfigReadModel struct {
ProviderType domain.IdentityProviderType
OIDCConfig *OIDCConfigReadModel
JWTConfig *JWTConfigReadModel
}
func NewIDPConfigReadModel(configID string) *IDPConfigReadModel {
@@ -45,6 +46,13 @@ func (rm *IDPConfigReadModel) AppendEvents(events ...eventstore.EventReader) {
case *idpconfig.OIDCConfigChangedEvent:
rm.ReadModel.AppendEvents(e)
rm.OIDCConfig.AppendEvents(event)
case *idpconfig.JWTConfigAddedEvent:
rm.JWTConfig = &JWTConfigReadModel{}
rm.ReadModel.AppendEvents(e)
rm.JWTConfig.AppendEvents(event)
case *idpconfig.JWTConfigChangedEvent:
rm.ReadModel.AppendEvents(e)
rm.JWTConfig.AppendEvents(event)
}
}
}
@@ -70,6 +78,11 @@ func (rm *IDPConfigReadModel) Reduce() error {
return err
}
}
if rm.JWTConfig != nil {
if err := rm.JWTConfig.Reduce(); err != nil {
return err
}
}
return rm.ReadModel.Reduce()
}