Skip to content

Commit

Permalink
fixed #2240 secondary ext-jwt processing would fail...
Browse files Browse the repository at this point in the history
...if ext-jwt primary wasn't enabled.

- fixes extra JWT processing on authentication endpoints (that would
  never pass)
- updates error message for missing NamedIndexStore implementations
- fixes ext-jwt store error stating that a named index is not present
  • Loading branch information
andrewpmartinez committed Jul 16, 2024
1 parent fbc8b50 commit 54c9f82
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 168 deletions.
5 changes: 5 additions & 0 deletions controller/db/external_jwt_signer_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (entity *ExternalJwtSigner) GetEntityType() string {
var _ ExternalJwtSignerStore = (*externalJwtSignerStoreImpl)(nil)

type ExternalJwtSignerStore interface {
NameIndexed
Store[*ExternalJwtSigner]
}

Expand All @@ -96,6 +97,10 @@ type externalJwtSignerStoreImpl struct {
issuerIndex boltz.ReadIndex
}

func (store *externalJwtSignerStoreImpl) GetNameIndex() boltz.ReadIndex {
return store.indexName
}

func (store *externalJwtSignerStoreImpl) initializeLocal() {
store.AddExtEntitySymbols()
store.indexName = store.addUniqueNameField()
Expand Down
5 changes: 5 additions & 0 deletions controller/env/appenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,11 @@ func (ae *AppEnv) ProcessJwt(rc *response.RequestContext, token *jwt.Token) erro
}

func (ae *AppEnv) FillRequestContext(rc *response.RequestContext) error {
// do no process auth headers on authenticate request
if strings.HasSuffix(rc.Request.URL.Path, "/v1/authenticate") && !strings.HasSuffix(rc.Request.URL.Path, "/authenticate/mfa") {
return nil
}

ztSession := ae.getZtSessionFromRequest(rc.Request)

if ztSession != "" {
Expand Down
Loading

0 comments on commit 54c9f82

Please sign in to comment.