Skip to content

Commit

Permalink
[HAWNG-151] Less confusing JAAS configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
grgrzybek authored and tadayosi committed Mar 7, 2024
1 parent 7396b92 commit 90486f0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void init() throws ServletException {
}

oidcConfiguration = authConfig.getOidcConfiguration();
authConfig.setConfiguration(oidcConfiguration);
enabled = oidcConfiguration.isEnabled();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ public class AuthenticationConfiguration {
private Configuration configuration;

private final ConfigManager configManager;
// OidcConfiguration implements javax.security.auth.login.Configuration, but let's keep it separate from
// this.configuration field
private OidcConfiguration oidcConfiguration;

private AuthenticationConfiguration(ServletContext servletContext) {
Expand Down Expand Up @@ -273,6 +275,7 @@ public void configureOidc() {
props.load(is);
this.oidcConfiguration = new OidcConfiguration(props);
this.oidcConfiguration.setRolePrincipalClasses(this.rolePrincipalClasses);
this.configuration = this.oidcConfiguration;
} catch (IOException e) {
LOG.warn("Couldn't read OIDC configuration file", e);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ private boolean booleanProperty(Properties props, String key, boolean defaultVal
public void setRolePrincipalClasses(String rolePrincipalClasses) {
if (rolePrincipalClasses == null || rolePrincipalClasses.isBlank()) {
this.rolePrincipalClasses = new String[0];
this.roleClass = RolePrincipal.class;
} else {
this.rolePrincipalClasses = rolePrincipalClasses.split("\\s*,\\s*");
Class<?> roleClass = null;
Expand Down
5 changes: 3 additions & 2 deletions hawtio-system/src/test/resources/hawtio-oidc.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# OpenID Connect configuration requred at client side

# URL of OpenID Connect Provider
# URL of OpenID Connect Provider - the URL after which ".well-known/openid-configuration" can be appended for
# discovery purposes
provider = https://login.microsoftonline.com/00000000-1111-2222-3333-444444444444/v2.0
# OpenID client identifier
client_id = 00000000-1111-2222-3333-444444444444
Expand Down Expand Up @@ -46,7 +47,7 @@ http.readTimeout = 10000
# HTTP proxy to use when connecting to OpenID Connect provider
#http.proxyURL = http://127.0.0.1:3128

# TLS configuration (system properties can be used, e.g., "${catalina.home}/conf/hawtio-oidc.properties"
# TLS configuration (system properties can be used, e.g., "${catalina.home}/conf/hawtio.jks")

ssl.protocol = TLSv1.3
ssl.truststore = src/test/resources/hawtio.jks
Expand Down

0 comments on commit 90486f0

Please sign in to comment.