Skip to content

Commit

Permalink
feat: add configurable additional parameters in admin-ui configuration
Browse files Browse the repository at this point in the history
…#7880 (#7881)

Signed-off-by: Arnab Dutta <arnab.bdutta@gmail.com>
Former-commit-id: 61e513b
  • Loading branch information
duttarnab authored Feb 29, 2024
1 parent 28067f3 commit 656ecf7
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package io.jans.ca.plugin.adminui.model.webhook;
package io.jans.as.model.config.adminui;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import java.io.Serializable;

@JsonPropertyOrder({"key", "value"})
@JsonIgnoreProperties(
ignoreUnknown = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class OIDCClientSettings {
private String opHost;
private String clientId;
private String clientSecret;
private List<KeyValuePair> additionalParameters;

public OIDCClientSettings() {
//Do not remove
Expand All @@ -42,6 +43,7 @@ public OIDCClientSettings(OIDCClientSettings oidcClientSettings) {
this.opHost = oidcClientSettings.getOpHost();
this.clientId = oidcClientSettings.getClientId();
this.clientSecret = oidcClientSettings.getClientSecret();
this.additionalParameters = oidcClientSettings.getAdditionalParameters();
}

@JsonInclude(JsonInclude.Include.NON_EMPTY)
Expand Down Expand Up @@ -91,6 +93,14 @@ public String getIntrospectionEndpoint() {
return introspectionEndpoint;
}

public List<KeyValuePair> getAdditionalParameters() {
return additionalParameters;
}

public void setAdditionalParameters(List<KeyValuePair> additionalParameters) {
this.additionalParameters = additionalParameters;
}

@Override
public String toString() {
return "OIDCClientSettings{" +
Expand All @@ -104,6 +114,7 @@ public String toString() {
", opHost='" + opHost + '\'' +
", clientId='" + clientId + '\'' +
", clientSecret='" + clientSecret + '\'' +
", additionalParameters='" + additionalParameters + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package io.jans.ca.plugin.adminui.model.auth;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.jans.as.model.config.adminui.KeyValuePair;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class AppConfigResponse {
@Schema(description = "Auth Server host", accessMode = Schema.AccessMode.READ_ONLY)
Expand All @@ -26,6 +30,16 @@ public class AppConfigResponse {
private String endSessionEndpoint;
@Schema(description = "Admin UI Session Timeout", accessMode = Schema.AccessMode.READ_WRITE)
private Integer sessionTimeoutInMins;
@Schema(description = "Additional Authentication Parameters", accessMode = Schema.AccessMode.READ_WRITE)
private List<KeyValuePair> additionalParameters;

public List<KeyValuePair> getAdditionalParameters() {
return additionalParameters;
}

public void setAdditionalParameters(List<KeyValuePair> additionalParameters) {
this.additionalParameters = additionalParameters;
}

public Integer getSessionTimeoutInMins() {
return sessionTimeoutInMins;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package io.jans.ca.plugin.adminui.model.config;


import io.jans.as.model.config.adminui.KeyValuePair;

import java.util.List;

public class AUIConfiguration {

private String appType;
Expand Down Expand Up @@ -34,6 +39,15 @@ public class AUIConfiguration {
private LicenseConfiguration licenseConfiguration;
//UI session timeout
private Integer sessionTimeoutInMins;
private List<KeyValuePair> additionalParameters;

public List<KeyValuePair> getAdditionalParameters() {
return additionalParameters;
}

public void setAdditionalParameters(List<KeyValuePair> additionalParameters) {
this.additionalParameters = additionalParameters;
}

public Integer getSessionTimeoutInMins() {
return sessionTimeoutInMins;
Expand Down Expand Up @@ -258,4 +272,5 @@ public LicenseConfiguration getLicenseConfiguration() {
public void setLicenseConfiguration(LicenseConfiguration licenseConfiguration) {
this.licenseConfiguration = licenseConfiguration;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jans.ca.plugin.adminui.model.webhook;

import io.jans.as.model.config.adminui.KeyValuePair;
import io.jans.orm.annotation.AttributeName;
import io.jans.orm.annotation.DataEntry;
import io.jans.orm.annotation.JsonObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public AppConfigResponse getAdminUIEditableConfiguration() throws ApplicationExc
appConfigResponse.setPostLogoutRedirectUri(auiConfiguration.getAuiWebServerPostLogoutRedirectUri());
appConfigResponse.setEndSessionEndpoint(auiConfiguration.getAuiWebServerEndSessionEndpoint());
appConfigResponse.setSessionTimeoutInMins(auiConfiguration.getSessionTimeoutInMins());
appConfigResponse.setAdditionalParameters(auiConfiguration.getAdditionalParameters());

return appConfigResponse;
} catch (Exception e) {
Expand All @@ -70,6 +71,10 @@ public AppConfigResponse editAdminUIEditableConfiguration(AppConfigResponse appC
adminConf.getMainSettings().getUiConfig().setSessionTimeoutInMins(appConfigResponse.getSessionTimeoutInMins());
auiConfigurationService.getAUIConfiguration().setSessionTimeoutInMins(appConfigResponse.getSessionTimeoutInMins());
}
if (!CollectionUtils.isEmpty(appConfigResponse.getAdditionalParameters())) {
adminConf.getMainSettings().getOidcConfig().getAuiWebClient().setAdditionalParameters(appConfigResponse.getAdditionalParameters());
auiConfigurationService.getAUIConfiguration().setAdditionalParameters(appConfigResponse.getAdditionalParameters());
}
entryManager.merge(adminConf);
return getAdminUIEditableConfiguration();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private AUIConfiguration addPropertiesToAUIConfiguration(String appType, AdminCo
auiConfig.setAuiBackendApiServerIntrospectionEndpoint(appConf.getMainSettings().getOidcConfig().getAuiBackendApiClient().getIntrospectionEndpoint());

auiConfig.setSessionTimeoutInMins(appConf.getMainSettings().getUiConfig().getSessionTimeoutInMins());

auiConfig.setAdditionalParameters(appConf.getMainSettings().getOidcConfig().getAuiWebClient().getAdditionalParameters());
return auiConfig;
}

Expand Down
19 changes: 12 additions & 7 deletions jans-config-api/plugins/docs/jans-admin-ui-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,18 @@ components:
type: integer
description: Admin UI Session Timeout
format: int32
additionalParameters:
type: array
description: Additional Authentication Parameters
items:
$ref: '#/components/schemas/KeyValuePair'
KeyValuePair:
type: object
properties:
key:
type: string
value:
type: string
LicenseRequest:
type: object
properties:
Expand Down Expand Up @@ -1618,13 +1630,6 @@ components:
properties:
ssa:
type: string
KeyValuePair:
type: object
properties:
key:
type: string
value:
type: string
WebhookEntry:
required:
- displayName
Expand Down

0 comments on commit 656ecf7

Please sign in to comment.