Skip to content

Commit

Permalink
Merge pull request #612 from VivekVinushanth/vv-add-enableDisableAppCap
Browse files Browse the repository at this point in the history
Add support for applicationAccessEnabled
  • Loading branch information
VivekVinushanth authored May 17, 2024
2 parents 63e589d + 9b3afaa commit a4c86c7
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class ApplicationModel {
private String templateId;
private Boolean isManagementApp = false;
private Boolean isB2BSelfServiceApp = false;
private Boolean applicationEnabled = true;
private AssociatedRolesConfig associatedRoles;
private ClaimConfiguration claimConfiguration;
private InboundProtocols inboundProtocolConfiguration;
Expand Down Expand Up @@ -220,6 +221,25 @@ public void setIsB2BSelfServiceApp(Boolean isB2BSelfServiceApp) {
this.isB2BSelfServiceApp = isB2BSelfServiceApp;
}

/**
* Decides whether the application is enabled.
**/
public ApplicationModel applicationEnabled(Boolean applicationEnabled) {

this.applicationEnabled = applicationEnabled;
return this;
}

@ApiModelProperty(example = "true", value = "Decides whether the application is enabled.")
@JsonProperty("applicationEnabled")
@Valid
public Boolean getApplicationEnabled() {
return applicationEnabled;
}
public void setApplicationEnabled(Boolean applicationEnabled) {
this.applicationEnabled = applicationEnabled;
}

/**
**/
public ApplicationModel associatedRoles(AssociatedRolesConfig associatedRoles) {
Expand Down Expand Up @@ -349,6 +369,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.templateId, applicationModel.templateId) &&
Objects.equals(this.isManagementApp, applicationModel.isManagementApp) &&
Objects.equals(this.isB2BSelfServiceApp, applicationModel.isB2BSelfServiceApp) &&
Objects.equals(this.applicationEnabled, applicationModel.applicationEnabled) &&
Objects.equals(this.associatedRoles, applicationModel.associatedRoles) &&
Objects.equals(this.claimConfiguration, applicationModel.claimConfiguration) &&
Objects.equals(this.inboundProtocolConfiguration, applicationModel.inboundProtocolConfiguration) &&
Expand All @@ -359,7 +380,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, isManagementApp, isB2BSelfServiceApp, associatedRoles, claimConfiguration, inboundProtocolConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, isManagementApp, isB2BSelfServiceApp, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocolConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
}

@Override
Expand All @@ -377,6 +398,7 @@ public String toString() {
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" isManagementApp: ").append(toIndentedString(isManagementApp)).append("\n");
sb.append(" isB2BSelfServiceApp: ").append(toIndentedString(isB2BSelfServiceApp)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n");
sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n");
sb.append(" inboundProtocolConfiguration: ").append(toIndentedString(inboundProtocolConfiguration)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ApplicationPatchModel {
private String accessUrl;
private String logoutReturnUrl;
private String templateId;
private Boolean applicationEnabled;
private AssociatedRolesConfig associatedRoles;
private ClaimConfiguration claimConfiguration;
private AuthenticationSequence authenticationSequence;
Expand Down Expand Up @@ -157,6 +158,25 @@ public void setTemplateId(String templateId) {
this.templateId = templateId;
}

/**
* Decides whether the application is enabled.
**/
public ApplicationPatchModel applicationEnabled(Boolean applicationEnabled) {

this.applicationEnabled = applicationEnabled;
return this;
}

@ApiModelProperty(example = "true", value = "Decides whether the application is enabled.")
@JsonProperty("applicationEnabled")
@Valid
public Boolean getApplicationEnabled() {
return applicationEnabled;
}
public void setApplicationEnabled(Boolean applicationEnabled) {
this.applicationEnabled = applicationEnabled;
}

/**
**/
public ApplicationPatchModel associatedRoles(AssociatedRolesConfig associatedRoles) {
Expand Down Expand Up @@ -265,6 +285,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.accessUrl, applicationPatchModel.accessUrl) &&
Objects.equals(this.logoutReturnUrl, applicationPatchModel.logoutReturnUrl) &&
Objects.equals(this.templateId, applicationPatchModel.templateId) &&
Objects.equals(this.applicationEnabled, applicationPatchModel.applicationEnabled) &&
Objects.equals(this.associatedRoles, applicationPatchModel.associatedRoles) &&
Objects.equals(this.claimConfiguration, applicationPatchModel.claimConfiguration) &&
Objects.equals(this.authenticationSequence, applicationPatchModel.authenticationSequence) &&
Expand All @@ -274,7 +295,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, associatedRoles, claimConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
return Objects.hash(name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, applicationEnabled, associatedRoles, claimConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
}

@Override
Expand All @@ -289,6 +310,7 @@ public String toString() {
sb.append(" accessUrl: ").append(toIndentedString(accessUrl)).append("\n");
sb.append(" logoutReturnUrl: ").append(toIndentedString(logoutReturnUrl)).append("\n");
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n");
sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n");
sb.append(" authenticationSequence: ").append(toIndentedString(authenticationSequence)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class ApplicationResponseModel {
private String templateId;
private Boolean isManagementApp;
private Boolean isB2BSelfServiceApp;
private Boolean applicationEnabled;
private AssociatedRolesConfig associatedRoles;
private ClaimConfiguration claimConfiguration;
private List<InboundProtocolListItem> inboundProtocols = null;
Expand Down Expand Up @@ -314,6 +315,25 @@ public void setIsB2BSelfServiceApp(Boolean isB2BSelfServiceApp) {
this.isB2BSelfServiceApp = isB2BSelfServiceApp;
}

/**
* Decides whether the application is enabled.
**/
public ApplicationResponseModel applicationEnabled(Boolean applicationEnabled) {

this.applicationEnabled = applicationEnabled;
return this;
}

@ApiModelProperty(example = "true", value = "Decides whether the application is enabled.")
@JsonProperty("applicationEnabled")
@Valid
public Boolean getApplicationEnabled() {
return applicationEnabled;
}
public void setApplicationEnabled(Boolean applicationEnabled) {
this.applicationEnabled = applicationEnabled;
}

/**
**/
public ApplicationResponseModel associatedRoles(AssociatedRolesConfig associatedRoles) {
Expand Down Expand Up @@ -472,6 +492,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.templateId, applicationResponseModel.templateId) &&
Objects.equals(this.isManagementApp, applicationResponseModel.isManagementApp) &&
Objects.equals(this.isB2BSelfServiceApp, applicationResponseModel.isB2BSelfServiceApp) &&
Objects.equals(this.applicationEnabled, applicationResponseModel.applicationEnabled) &&
Objects.equals(this.associatedRoles, applicationResponseModel.associatedRoles) &&
Objects.equals(this.claimConfiguration, applicationResponseModel.claimConfiguration) &&
Objects.equals(this.inboundProtocols, applicationResponseModel.inboundProtocols) &&
Expand All @@ -483,7 +504,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, clientId, issuer, realm, templateId, isManagementApp, isB2BSelfServiceApp, associatedRoles, claimConfiguration, inboundProtocols, authenticationSequence, advancedConfigurations, provisioningConfigurations, access);
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, clientId, issuer, realm, templateId, isManagementApp, isB2BSelfServiceApp, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocols, authenticationSequence, advancedConfigurations, provisioningConfigurations, access);
}

@Override
Expand All @@ -504,6 +525,7 @@ public String toString() {
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" isManagementApp: ").append(toIndentedString(isManagementApp)).append("\n");
sb.append(" isB2BSelfServiceApp: ").append(toIndentedString(isB2BSelfServiceApp)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n");
sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n");
sb.append(" inboundProtocols: ").append(toIndentedString(inboundProtocols)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ApplicationDTO apply(ApplicationModel applicationModel) throws IdentityAp
application.setTemplateId(applicationModel.getTemplateId());
setIfNotNull(applicationModel.getIsManagementApp(), application::setManagementApp);
setIfNotNull(applicationModel.getIsB2BSelfServiceApp(), application::setB2BSelfServiceApp);

setIfNotNull(applicationModel.getApplicationEnabled(), application::setApplicationAccessEnabled);

addAdvancedConfigurationToApplication(application, applicationModel.getAdvancedConfigurations());
addClaimConfigurationToApplication(application, applicationModel.getClaimConfiguration());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public class ServiceProviderToApiModel implements Function<ServiceProvider, Appl
private static final Set<String> systemApplications = ApplicationManagementServiceHolder
.getApplicationManagementService().getSystemApplications();
private static final String IS_FRAGMENT_APP = "isFragmentApp";
private static final String APPLICATION_ACCESS_ENABLED = "applicationEnabled";
private static final String useUserIdForDefaultSubject = "useUserIdForDefaultSubject";

@Override
Expand All @@ -127,6 +128,7 @@ public ApplicationResponseModel apply(ServiceProvider application) {
.realm(getInboundKey(application, "passivests"))
.templateId(application.getTemplateId())
.isManagementApp(application.isManagementApp())
.applicationEnabled(application.isApplicationAccessEnabled())
.associatedRoles(buildAssociatedRoles(application))
.claimConfiguration(buildClaimConfiguration(application))
.inboundProtocols(buildInboundProtocols(application))
Expand Down Expand Up @@ -521,6 +523,7 @@ private ServiceProviderProperty[] removeAndSetSpProperties(ServiceProviderProper
spPropertyList.removeIf(property -> TEMPLATE_ID_SP_PROPERTY_NAME.equals(property.getName()));
spPropertyList.removeIf(property -> IS_MANAGEMENT_APP_SP_PROPERTY_NAME.equals(property.getName()));
spPropertyList.removeIf(property -> IS_ATTESTATION_ENABLED_PROPERTY_NAME.equals(property.getName()));
spPropertyList.removeIf(property -> APPLICATION_ACCESS_ENABLED.equals(property.getName()));
spPropertyList.removeIf(property ->
IS_API_BASED_AUTHENTICATION_ENABLED_PROPERTY_NAME.equals(property.getName()));
spPropertyList.removeIf(property ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void apply(ServiceProvider serviceProvider, ApplicationPatchModel applica
setIfNotNull(applicationPatchModel.getImageUrl(), serviceProvider::setImageUrl);
setIfNotNull(applicationPatchModel.getAccessUrl(), serviceProvider::setAccessUrl);
setIfNotNull(applicationPatchModel.getTemplateId(), serviceProvider::setTemplateId);
setIfNotNull(applicationPatchModel.getApplicationEnabled(), serviceProvider::setApplicationAccessEnabled);

patchAssociatedRolesConfigurations(serviceProvider, applicationPatchModel.getAssociatedRoles());
patchClaimConfiguration(serviceProvider, applicationPatchModel.getClaimConfiguration());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,11 @@ components:
type: boolean
example: false
description: Decides whether the application used to for B2B self service
applicationEnabled:
default: true
type: boolean
example: true
description: Decides whether the application is enabled.
associatedRoles:
$ref: '#/components/schemas/AssociatedRolesConfig'
claimConfiguration:
Expand Down Expand Up @@ -2926,6 +2931,10 @@ components:
type: boolean
example: false
description: Decides whether the application used to for B2B self service
applicationEnabled:
type: boolean
example: true
description: Decides whether the application is enabled.
associatedRoles:
$ref: '#/components/schemas/AssociatedRolesConfig'
claimConfiguration:
Expand Down Expand Up @@ -2966,6 +2975,10 @@ components:
templateId:
type: string
example: "adwefi2429asdfdf94444rraf44"
applicationEnabled:
type: boolean
example: true
description: Decides whether the application is enabled.
associatedRoles:
$ref: '#/components/schemas/AssociatedRolesConfig'
claimConfiguration:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@
<maven.buildnumber.plugin.version>1.4</maven.buildnumber.plugin.version>
<org.apache.felix.annotations.version>1.2.4</org.apache.felix.annotations.version>
<identity.governance.version>1.8.62</identity.governance.version>
<carbon.identity.framework.version>7.0.50</carbon.identity.framework.version>
<carbon.identity.framework.version>7.2.23</carbon.identity.framework.version>
<maven.findbugsplugin.version>3.0.5</maven.findbugsplugin.version>
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>
Expand Down

0 comments on commit a4c86c7

Please sign in to comment.