feat: add apis and application keys (#1327)

* feat: add apis and application keys

* VerifyOIDCClientSecret

* Update internal/v2/repository/project/api_config.go

Co-authored-by: Fabi <[email protected]>

* Update internal/v2/repository/project/key.go

Co-authored-by: Fabi <[email protected]>

* fix append ApplicationKeyWriteModel

Co-authored-by: Fabi <[email protected]>
This commit is contained in:
Livio Amstutz
2021-02-22 12:27:47 +01:00
committed by GitHub
co-authored by Fabi
parent a7cc57822b
commit 2ba56595b1
35 changed files with 1421 additions and 527 deletions
@@ -35,7 +35,7 @@ type OIDCApplicationWriteModel struct {
State domain.AppState
}
func NewOIDCApplicationWriteModelWithAppIDC(projectID, appID, resourceOwner string) *OIDCApplicationWriteModel {
func NewOIDCApplicationWriteModelWithAppID(projectID, appID, resourceOwner string) *OIDCApplicationWriteModel {
return &OIDCApplicationWriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: projectID,
@@ -154,9 +154,6 @@ func (wm *OIDCApplicationWriteModel) appendAddOIDCEvent(e *project.OIDCConfigAdd
}
func (wm *OIDCApplicationWriteModel) appendChangeOIDCEvent(e *project.OIDCConfigChangedEvent) {
if e.ClientID != nil {
wm.ClientID = *e.ClientID
}
if e.RedirectUris != nil {
wm.RedirectUris = *e.RedirectUris
}
@@ -218,8 +215,7 @@ func (wm *OIDCApplicationWriteModel) Query() *eventstore.SearchQueryBuilder {
func (wm *OIDCApplicationWriteModel) NewChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
appID,
clientID string,
appID string,
redirectURIS,
postLogoutRedirectURIs []string,
responseTypes []domain.OIDCResponseType,
@@ -237,9 +233,6 @@ func (wm *OIDCApplicationWriteModel) NewChangedEvent(
changes := make([]project.OIDCConfigChanges, 0)
var err error
if wm.ClientID != clientID {
changes = append(changes, project.ChangeClientID(clientID))
}
if !reflect.DeepEqual(wm.RedirectUris, redirectURIS) {
changes = append(changes, project.ChangeRedirectURIs(redirectURIS))
}