forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#43433 from michalvavrik/feature/fix-oidc…
…-issuer-unavailable Make sure OIDC issuer-based tenant resolver can recover when OIDC server becomes available after Quarkus app started
- Loading branch information
Showing
18 changed files
with
1,000 additions
and
610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 95 additions & 91 deletions
186
...sions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java
Large diffs are not rendered by default.
Oops, something went wrong.
294 changes: 57 additions & 237 deletions
294
...sions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java
Large diffs are not rendered by default.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/LazyTenantConfigContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package io.quarkus.oidc.runtime; | ||
|
||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
import javax.crypto.SecretKey; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
import io.quarkus.oidc.OidcConfigurationMetadata; | ||
import io.quarkus.oidc.OidcRedirectFilter; | ||
import io.quarkus.oidc.OidcTenantConfig; | ||
import io.quarkus.oidc.Redirect; | ||
import io.smallrye.mutiny.Uni; | ||
|
||
final class LazyTenantConfigContext implements TenantConfigContext { | ||
|
||
private static final Logger LOG = Logger.getLogger(LazyTenantConfigContext.class); | ||
|
||
private final Supplier<Uni<TenantConfigContext>> staticTenantCreator; | ||
private volatile TenantConfigContext delegate; | ||
|
||
LazyTenantConfigContext(TenantConfigContext delegate, Supplier<Uni<TenantConfigContext>> staticTenantCreator) { | ||
this.staticTenantCreator = staticTenantCreator; | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public Uni<TenantConfigContext> initialize() { | ||
if (!delegate.ready()) { | ||
LOG.debugf("Tenant '%s' is not initialized yet, trying to create OIDC connection now", | ||
delegate.oidcConfig().tenantId.get()); | ||
return staticTenantCreator.get().invoke(ctx -> LazyTenantConfigContext.this.delegate = ctx); | ||
} | ||
return Uni.createFrom().item(delegate); | ||
} | ||
|
||
@Override | ||
public OidcTenantConfig oidcConfig() { | ||
return delegate.oidcConfig(); | ||
} | ||
|
||
@Override | ||
public OidcProvider provider() { | ||
return delegate.provider(); | ||
} | ||
|
||
@Override | ||
public boolean ready() { | ||
return delegate.ready(); | ||
} | ||
|
||
@Override | ||
public OidcTenantConfig getOidcTenantConfig() { | ||
return delegate.getOidcTenantConfig(); | ||
} | ||
|
||
@Override | ||
public OidcConfigurationMetadata getOidcMetadata() { | ||
return delegate.getOidcMetadata(); | ||
} | ||
|
||
@Override | ||
public OidcProviderClient getOidcProviderClient() { | ||
return delegate.getOidcProviderClient(); | ||
} | ||
|
||
@Override | ||
public SecretKey getStateEncryptionKey() { | ||
return delegate.getStateEncryptionKey(); | ||
} | ||
|
||
@Override | ||
public SecretKey getTokenEncSecretKey() { | ||
return delegate.getTokenEncSecretKey(); | ||
} | ||
|
||
@Override | ||
public SecretKey getInternalIdTokenSecretKey() { | ||
return delegate.getInternalIdTokenSecretKey(); | ||
} | ||
|
||
@Override | ||
public List<OidcRedirectFilter> getOidcRedirectFilters(Redirect.Location loc) { | ||
return delegate.getOidcRedirectFilters(loc); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.