Skip to content

Commit

Permalink
feat(config-api): saml metedata elements save (#7804)
Browse files Browse the repository at this point in the history
* feat(config-api): saml plugin changes for new fields

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): kc link plugin endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): kc link plugin endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): kc link plugin endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): saml plugin changes

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): kc plugin changes

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): saml plugin changes for metadata elements

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): resolved merge conflict

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): resolved merge conflict

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): saml metedata elements save

Signed-off-by: pujavs <pujas.works@gmail.com>

---------

Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: Mustafa Baser <mbaser@mail.com>
  • Loading branch information
pujavs authored and devrimyatar committed Feb 27, 2024
1 parent e9ac1b2 commit 68b1794
Show file tree
Hide file tree
Showing 13 changed files with 399 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public class ApiAppConfiguration implements Configuration {

private boolean configOauthEnabled;
private boolean customAttributeValidationEnabled;
private List<String> apiApprovedIssuer;
private String apiProtectionType;
private String apiClientId;
Expand Down Expand Up @@ -48,6 +49,14 @@ public void setConfigOauthEnabled(boolean configOauthEnabled) {
this.configOauthEnabled = configOauthEnabled;
}

public boolean isCustomAttributeValidationEnabled() {
return customAttributeValidationEnabled;
}

public void setCustomAttributeValidationEnabled(boolean customAttributeValidationEnabled) {
this.customAttributeValidationEnabled = customAttributeValidationEnabled;
}

public List<String> getApiApprovedIssuer() {
return apiApprovedIssuer;
}
Expand Down Expand Up @@ -260,24 +269,20 @@ public void setPlugins(List<PluginConf> plugins) {

@Override
public String toString() {
return "ApiAppConfiguration [" + " apiApprovedIssuer=" + apiApprovedIssuer + ", apiProtectionType="
return "ApiAppConfiguration [configOauthEnabled=" + configOauthEnabled + ", customAttributeValidationEnabled="
+ customAttributeValidationEnabled + ", apiApprovedIssuer=" + apiApprovedIssuer + ", apiProtectionType="
+ apiProtectionType + ", apiClientId=" + apiClientId + ", apiClientPassword=" + apiClientPassword
+ ", endpointInjectionEnabled=" + endpointInjectionEnabled + ", authIssuerUrl=" + authIssuerUrl
+ ", authOpenidConfigurationUrl=" + authOpenidConfigurationUrl + ", authOpenidIntrospectionUrl="
+ authOpenidIntrospectionUrl + ", authOpenidTokenUrl=" + authOpenidTokenUrl + ", authOpenidRevokeUrl="
+ authOpenidRevokeUrl + ", smallryeHealthRootPath=" + smallryeHealthRootPath
+ ", corsConfigurationFilters=" + corsConfigurationFilters + ", exclusiveAuthScopes="
+ exclusiveAuthScopes + ", loggingLevel=" + loggingLevel + " , loggingLayout=" + loggingLayout
+ " , externalLoggerConfiguration=" + externalLoggerConfiguration + " , disableJdkLogger="
+ disableJdkLogger + " , maxCount =" + maxCount
+ " , userExclusionAttributes="+ userExclusionAttributes
+ " , userMandatoryAttributes="+ userMandatoryAttributes
+ " , agamaConfiguration="+ agamaConfiguration
+ " , auditLogConf="+ auditLogConf
+ " , dataFormatConversionConf="+ dataFormatConversionConf
+ " , plugins="+ plugins
+ authOpenidRevokeUrl + ", smallryeHealthRootPath=" + smallryeHealthRootPath + ", exclusiveAuthScopes="
+ exclusiveAuthScopes + ", corsConfigurationFilters=" + corsConfigurationFilters + ", loggingLevel="
+ loggingLevel + ", loggingLayout=" + loggingLayout + ", externalLoggerConfiguration="
+ externalLoggerConfiguration + ", disableJdkLogger=" + disableJdkLogger + ", maxCount=" + maxCount
+ ", userExclusionAttributes=" + userExclusionAttributes + ", userMandatoryAttributes="
+ userMandatoryAttributes + ", agamaConfiguration=" + agamaConfiguration + ", auditLogConf="
+ auditLogConf + ", dataFormatConversionConf=" + dataFormatConversionConf + ", plugins=" + plugins
+ "]";
}

}

26 changes: 17 additions & 9 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ paths:
}
"401":
description: Unauthorized
"406":
description: NotAcceptable
"500":
description: InternalServerError
security:
Expand Down Expand Up @@ -772,8 +774,12 @@ paths:
],
"whitePagesCanView": false
}
"400":
description: BadRequest
"401":
description: Unauthorized
"406":
description: NotAcceptable
"500":
description: InternalServerError
security:
Expand Down Expand Up @@ -7888,21 +7894,21 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
whitePagesCanView:
type: boolean
selected:
type: boolean
adminCanEdit:
adminCanAccess:
type: boolean
adminCanView:
userCanAccess:
type: boolean
userCanEdit:
type: boolean
userCanView:
type: boolean
userCanEdit:
adminCanView:
type: boolean
userCanAccess:
adminCanEdit:
type: boolean
adminCanAccess:
whitePagesCanView:
type: boolean
baseDn:
type: string
Expand Down Expand Up @@ -9520,6 +9526,8 @@ components:
properties:
configOauthEnabled:
type: boolean
customAttributeValidationEnabled:
type: boolean
apiApprovedIssuer:
type: array
items:
Expand Down Expand Up @@ -10172,10 +10180,10 @@ components:
ttl:
type: integer
format: int32
opbrowserState:
type: string
persisted:
type: boolean
opbrowserState:
type: string
SessionIdAccessMap:
type: object
properties:
Expand Down
21 changes: 13 additions & 8 deletions jans-config-api/plugins/docs/kc-saml-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,20 @@ components:
type: string
signResponses:
type: string
SAMLMetadata:
type: object
properties:
nameIDPolicyFormat:
type: string
entityId:
type: string
singleLogoutServiceUrl:
type: string
TrustRelationship:
required:
- clientId
- description
- displayName
- name
- spMetaDataSourceType
type: object
properties:
Expand All @@ -1021,7 +1030,7 @@ components:
type: string
owner:
type: string
clientId:
name:
maxLength: 60
minLength: 0
type: string
Expand Down Expand Up @@ -1061,12 +1070,8 @@ components:
- federation
- manual
- mdq
nameIDPolicyFormat:
type: string
entityId:
type: string
singleLogoutServiceUrl:
type: string
samlMetadata:
$ref: '#/components/schemas/SAMLMetadata'
redirectUris:
type: array
items:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.configapi.plugin.saml.model;


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

import java.io.Serializable;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SAMLMetadata implements Serializable {

private static final long serialVersionUID = 1L;
private String nameIDPolicyFormat;
private String entityId;
private String singleLogoutServiceUrl;

public String getNameIDPolicyFormat() {
return nameIDPolicyFormat;
}

public void setNameIDPolicyFormat(String nameIDPolicyFormat) {
this.nameIDPolicyFormat = nameIDPolicyFormat;
}

public String getEntityId() {
return entityId;
}

public void setEntityId(String entityId) {
this.entityId = entityId;
}

public String getSingleLogoutServiceUrl() {
return singleLogoutServiceUrl;
}

public void setSingleLogoutServiceUrl(String singleLogoutServiceUrl) {
this.singleLogoutServiceUrl = singleLogoutServiceUrl;
}

@Override
public String toString() {
return "SPMetadata [nameIDPolicyFormat=" + nameIDPolicyFormat + ", entityId=" + entityId
+ ", singleLogoutServiceUrl=" + singleLogoutServiceUrl + "]";
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.jans.model.GluuStatus;
import io.jans.orm.annotation.AttributeName;
import io.jans.orm.annotation.DataEntry;
import io.jans.orm.annotation.JsonObject;
import io.jans.orm.annotation.ObjectClass;
import io.jans.orm.model.base.Entry;
import io.swagger.v3.oas.annotations.Hidden;
Expand All @@ -30,7 +31,7 @@


@DataEntry(sortBy = { "displayName" })
@ObjectClass(value = "jansSAMLconfig")
@ObjectClass(value = "jansTrustRelationship")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TrustRelationship extends Entry implements Serializable {

Expand All @@ -42,10 +43,10 @@ public class TrustRelationship extends Entry implements Serializable {
@AttributeName
private String owner;

@AttributeName(name = "jansClntId")
@AttributeName(name = "name")
@NotNull
@Size(min = 0, max = 60, message = "Length of the Client Id should not exceed 60")
private String clientId;
@Size(min = 0, max = 60, message = "Length of the name should not exceed 60")
private String name;

@NotNull
@Size(min = 0, max = 60, message = "Length of the Display Name should not exceed 60")
Expand Down Expand Up @@ -86,7 +87,7 @@ public class TrustRelationship extends Entry implements Serializable {
private boolean enabled;

/**
* Always list this client in the Account UI, even if the user does not have an
* Always list this in the Account UI, even if the user does not have an
* active session.
*/
@AttributeName(name = "displayInConsole")
Expand All @@ -110,14 +111,9 @@ public class TrustRelationship extends Entry implements Serializable {
@AttributeName(name = "jansSAMLspMetaDataSourceTyp")
private MetadataSourceType spMetaDataSourceType;

@AttributeName(name = "nameIDPolicyFormat")
private String nameIDPolicyFormat;

@AttributeName(name = "entityId")
private String entityId;

@AttributeName(name = "singleLogoutServiceUrl")
private String singleLogoutServiceUrl;
@JsonObject
@AttributeName(name = "samlMetadata")
private SAMLMetadata samlMetadata;

@AttributeName(name = "jansRedirectURI")
private String[] redirectUris;
Expand Down Expand Up @@ -173,12 +169,12 @@ public void setOwner(String owner) {
this.owner = owner;
}

public String getClientId() {
return clientId;
public String getName() {
return name;
}

public void setClientId(String clientId) {
this.clientId = clientId;
public void setName(String name) {
this.name = name;
}

public String getDisplayName() {
Expand Down Expand Up @@ -285,28 +281,12 @@ public void setSpMetaDataSourceType(MetadataSourceType spMetaDataSourceType) {
this.spMetaDataSourceType = spMetaDataSourceType;
}

public String getNameIDPolicyFormat() {
return nameIDPolicyFormat;
}

public void setNameIDPolicyFormat(String nameIDPolicyFormat) {
this.nameIDPolicyFormat = nameIDPolicyFormat;
}

public String getEntityId() {
return entityId;
public SAMLMetadata getSamlMetadata() {
return samlMetadata;
}

public void setEntityId(String entityId) {
this.entityId = entityId;
}

public String getSingleLogoutServiceUrl() {
return singleLogoutServiceUrl;
}

public void setSingleLogoutServiceUrl(String singleLogoutServiceUrl) {
this.singleLogoutServiceUrl = singleLogoutServiceUrl;
public void setSamlMetadata(SAMLMetadata samlMetadata) {
this.samlMetadata = samlMetadata;
}

public String[] getRedirectUris() {
Expand Down Expand Up @@ -411,18 +391,17 @@ public static void sortByDataSourceType(List<TrustRelationship> trustRelationshi

@Override
public String toString() {
return "TrustRelationship [inum=" + inum + ", owner=" + owner + ", clientId=" + clientId + ", displayName="
return "TrustRelationship [inum=" + inum + ", owner=" + owner + ", name=" + name + ", displayName="
+ displayName + ", description=" + description + ", rootUrl=" + rootUrl + ", adminUrl=" + adminUrl
+ ", baseUrl=" + baseUrl + ", surrogateAuthRequired=" + surrogateAuthRequired + ", enabled=" + enabled
+ ", alwaysDisplayInConsole=" + alwaysDisplayInConsole + ", clientAuthenticatorType="
+ clientAuthenticatorType + ", secret=" + secret + ", registrationAccessToken="
+ registrationAccessToken + ", consentRequired=" + consentRequired + ", spMetaDataSourceType="
+ spMetaDataSourceType + ", nameIDPolicyFormat=" + nameIDPolicyFormat + ", entityId=" + entityId
+ ", singleLogoutServiceUrl=" + singleLogoutServiceUrl + ", redirectUris="
+ spMetaDataSourceType + ", samlMetadata=" + samlMetadata + ", redirectUris="
+ Arrays.toString(redirectUris) + ", spMetaDataFN=" + spMetaDataFN + ", spMetaDataURL=" + spMetaDataURL
+ ", metaLocation=" + metaLocation + ", releasedAttributes=" + releasedAttributes + ", url=" + url
+ ", spLogoutURL=" + spLogoutURL + ", status=" + status + ", validationStatus=" + validationStatus
+ ", validationLog=" + validationLog + ", profileConfigurations=" + profileConfigurations + "]";
}

}
Loading

0 comments on commit 68b1794

Please sign in to comment.