Skip to content

Commit

Permalink
Merge pull request #419 from wso2-extensions/revert-412-protocol
Browse files Browse the repository at this point in the history
Revert "Add protocol config handler"
  • Loading branch information
VivekVinushanth authored Feb 16, 2024
2 parents 9d6cfe6 + 5a568ce commit 9dd1485
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 958 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,6 @@
<xs:element minOccurs="0" name="tenantZero" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AuditLogDataType">
<xs:sequence>
<xs:element name="entry" type="ax2380:MapEntry" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MapEntry">
<xs:sequence>
<xs:element name="key" type="xs:string"/>
<xs:element name="value" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SAMLSSOServiceProviderDTO">
<!-- <xs:complexContent>-->
<!-- <xs:extension base="ax2381:InboundConfigurationProtocol">-->
Expand All @@ -257,7 +246,6 @@
<xs:element minOccurs="0" name="assertionEncryptionAlgorithmURI" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="assertionQueryRequestProfileEnabled" type="xs:boolean"/>
<xs:element minOccurs="0" name="attributeConsumingServiceIndex" nillable="true" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="auditLogData" nillable="true" type="ax2380:AuditLogDataType"/>
<xs:element minOccurs="0" name="certAlias" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="certificateContent" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="defaultAssertionConsumerUrl" nillable="true" type="xs:string"/>
Expand Down
8 changes: 0 additions & 8 deletions components/org.wso2.carbon.identity.sso.saml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,6 @@
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<!-- for Java 17 Compatibility -->
<dependency>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,9 @@ public boolean updateRPServiceProvider(SAMLSSOServiceProviderDTO serviceProvider
* @throws IdentityException
*/
public SAMLSSOServiceProviderDTO createServiceProvider(SAMLSSOServiceProviderDTO spDto) throws IdentityException {

return createServiceProvider(spDto, true);
}

SAMLSSOServiceProviderDTO createServiceProvider(SAMLSSOServiceProviderDTO spDto, boolean enableAuditing) throws IdentityException {


validateSAMLSSOServiceProviderDTO(spDto);
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry(), enableAuditing);
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry());
try {
return configAdmin.addSAMLServiceProvider(spDto);
} catch (IdentityException ex) {
Expand All @@ -142,15 +137,8 @@ SAMLSSOServiceProviderDTO createServiceProvider(SAMLSSOServiceProviderDTO spDto,
public SAMLSSOServiceProviderDTO updateServiceProvider(SAMLSSOServiceProviderDTO serviceProviderDTO, String currentIssuer)
throws IdentityException {

return updateServiceProvider(serviceProviderDTO, currentIssuer, true);
}

SAMLSSOServiceProviderDTO updateServiceProvider(SAMLSSOServiceProviderDTO serviceProviderDTO, String currentIssuer,
boolean enableAuditing)
throws IdentityException {

validateSAMLSSOServiceProviderDTO(serviceProviderDTO);
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry(), enableAuditing);
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry());
try {
return configAdmin.updateSAMLServiceProvider(serviceProviderDTO, currentIssuer);
} catch (IdentityException ex) {
Expand Down Expand Up @@ -191,14 +179,8 @@ private void validateSAMLSSOServiceProviderDTO(SAMLSSOServiceProviderDTO service

public SAMLSSOServiceProviderDTO uploadRPServiceProvider(String metadata) throws IdentitySAML2SSOException {

return uploadRPServiceProvider(metadata, true);
}

SAMLSSOServiceProviderDTO uploadRPServiceProvider(String metadata, boolean enableAuditing)
throws IdentitySAML2SSOException {

try {
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry(), enableAuditing);
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry());
if (log.isDebugEnabled()) {
log.debug("Creating SAML Service Provider with metadata: " + metadata);
}
Expand All @@ -220,15 +202,8 @@ SAMLSSOServiceProviderDTO uploadRPServiceProvider(String metadata, boolean enabl
public SAMLSSOServiceProviderDTO updateRPServiceProviderWithMetadata(String metadata, String currentIssuer)
throws IdentitySAML2SSOException {

return updateRPServiceProviderWithMetadata(metadata, currentIssuer, true);
}

SAMLSSOServiceProviderDTO updateRPServiceProviderWithMetadata(String metadata, String currentIssuer,
boolean enableAuditing)
throws IdentitySAML2SSOException {

try {
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry(), enableAuditing);
SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry());
if (log.isDebugEnabled()) {
log.debug("Updating SAML Service Provider with metadata: " + metadata);
}
Expand All @@ -247,21 +222,15 @@ SAMLSSOServiceProviderDTO updateRPServiceProviderWithMetadata(String metadata, S
*/
public SAMLSSOServiceProviderDTO createServiceProviderWithMetadataURL(String metadataUrl)
throws IdentitySAML2SSOException {

return createServiceProviderWithMetadataURL(metadataUrl, true);
}

SAMLSSOServiceProviderDTO createServiceProviderWithMetadataURL(String metadataUrl, boolean enableAuditing)
throws IdentitySAML2SSOException {


try {
URL url = new URL(metadataUrl);
URLConnection con = url.openConnection();
con.setConnectTimeout(getConnectionTimeoutInMillis());
con.setReadTimeout(getReadTimeoutInMillis());
try (InputStream inputStream = new BoundedInputStream(con.getInputStream(), getMaxSizeInBytes())) {
String metadata = IOUtils.toString(inputStream);
return uploadRPServiceProvider(metadata, enableAuditing);
return uploadRPServiceProvider(metadata);
}
} catch (IOException e) {
throw handleIOException(URL_NOT_FOUND, "Non-existing metadata URL for SAML service provider creation in tenantDomain: "
Expand All @@ -280,26 +249,19 @@ SAMLSSOServiceProviderDTO createServiceProviderWithMetadataURL(String metadataUr
public SAMLSSOServiceProviderDTO updateServiceProviderWithMetadataURL(String metadataUrl, String currentIssuer)
throws IdentitySAML2SSOException {

return updateServiceProviderWithMetadataURL(metadataUrl, currentIssuer, true);
}

SAMLSSOServiceProviderDTO updateServiceProviderWithMetadataURL(String metadataUrl, String currentIssuer,
boolean enableAuditing)
throws IdentitySAML2SSOException {

try {
URL url = new URL(metadataUrl);
URLConnection connection = url.openConnection();
connection.setConnectTimeout(getConnectionTimeoutInMillis());
connection.setReadTimeout(getReadTimeoutInMillis());
try (InputStream inputStream = new BoundedInputStream(connection.getInputStream(), getMaxSizeInBytes())) {
String metadata = IOUtils.toString(inputStream);
return updateRPServiceProviderWithMetadata(metadata, currentIssuer, enableAuditing);
return updateRPServiceProviderWithMetadata(metadata, currentIssuer);
}
} catch (IOException e) {
throw handleIOException(URL_NOT_FOUND,
"Non-existing metadata URL for SAML service provider creation in tenantDomain: "
+ getTenantDomain(), e);
+ getTenantDomain(), e);
}
}

Expand Down Expand Up @@ -497,13 +459,8 @@ public String getKeyEncryptionAlgorithmURIByConfig() {
*/
public boolean removeServiceProvider(String issuer) throws IdentityException {

return removeServiceProvider(issuer, true);
}

boolean removeServiceProvider(String issuer, boolean enableAuditing) throws IdentityException {

try {
SAMLSSOConfigAdmin ssoConfigAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry(), enableAuditing);
SAMLSSOConfigAdmin ssoConfigAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry());
return ssoConfigAdmin.removeServiceProvider(issuer);
} catch (IdentityException ex) {
String msg = "Error removing SAML SP with issuer: " + issuer + " in tenantDomain: " + getTenantDomain();
Expand Down Expand Up @@ -600,12 +557,9 @@ private Registry getGovernanceRegistry() {
private IdentitySAML2SSOException handleException(String message, IdentityException ex) {

setErrorCodeIfNotDefined(ex);
if (ex instanceof IdentitySAML2ClientException) {
return (IdentitySAML2ClientException) ex;
} else if (ex instanceof IdentitySAML2SSOException) {
if (ex instanceof IdentitySAML2SSOException) {
return (IdentitySAML2SSOException) ex;
}
else {
} else {
return new IdentitySAML2SSOException(ex.getErrorCode(), message, ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ public static class LogConstants {

public static final String CREATE_SAML_APPLICATION = "CREATE SAML APPLICATION";
public static final String DELETE_SAML_APPLICATION = "DELETE SAML APPLICATION";
public static final String UPDATE_SAML_APPLICATION = "UPDATE SAML APPLICATION";
public static final String SAML_INBOUND_SERVICE = "saml-inbound-service";

/**
Expand Down
Loading

0 comments on commit 9dd1485

Please sign in to comment.