This repository was archived by the owner on Aug 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
#81: Backport all changes to 3.7.x #84
Open
oarrietadotcms
wants to merge
2
commits into
4.0-3.7.x
Choose a base branch
from
issue-81-Backport-3.7
base: 4.0-3.7.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| com.dotcms.repackage.javax.portlet.title.saml=SAML Configuration | ||
| add-idp=Add New SAML Configuration | ||
| disabled-sites=Disabled SAML Authentication | ||
| disable-site=Disable SAML per Site | ||
| download-sp-metadata=Download SP Metadata | ||
| idp-name=IdP Name | ||
| sp-metadata-file=SP Metadata File | ||
| idp-config-name-label=Configuration Name | ||
| idp-id=Configuration Id | ||
| idp-status-label=Enabled? | ||
| sp-issuer-url-label=SP Issuer URL | ||
| sp-endpoint-hostname-label=SP Endponint Hostname | ||
| private-key-label=Private Key | ||
| public-certificate-label=Public Cert | ||
| idp-metadata-label=IdP Metadata File | ||
| idp-validation-label=Validation Type | ||
| optional-properties-label=Override Properties | ||
| add-site=Sites | ||
| add-site-to-config=Add Site | ||
| site=Site | ||
| remove=Remove | ||
| add-edit-dialog-title=Add/Edit SAML Configuration | ||
| disabled-sites-dialog-title=Add/Remove Disabled SAML Sites | ||
| delete-dialog-title=Delete SAML Configuration Confirmation | ||
| delete-dialog-text=Are you sure you want to delete this SAML Configuration? (This operation cannot be undone) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <portlet> | ||
| <portlet-name>saml</portlet-name> | ||
| <display-name>SAML Configuration</display-name> | ||
| <portlet-class>com.liferay.portlet.JSPPortlet</portlet-class> | ||
| <init-param> | ||
| <name>view-jsp</name> | ||
| <value>/plugins/plugin-com.dotcms.dotsaml/saml/view_saml_configuration.jsp</value> | ||
| </init-param> | ||
| <security-role-ref> | ||
| <role-name>CMS Administrator</role-name> | ||
| </security-role-ref> | ||
| </portlet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
346 changes: 346 additions & 0 deletions
346
src/com/dotcms/plugin/saml/v3/rest/api/v1/DotSamlResource.java
Large diffs are not rendered by default.
Oops, something went wrong.
203 changes: 203 additions & 0 deletions
203
src/com/dotcms/plugin/saml/v3/rest/api/v1/IdpConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| package com.dotcms.plugin.saml.v3.rest.api.v1; | ||
|
|
||
| import java.io.File; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
| import java.util.Properties; | ||
|
|
||
| public class IdpConfig { | ||
|
|
||
| private String id; | ||
| private String idpName; | ||
| private boolean enabled; | ||
| private String sPIssuerURL; | ||
| private String sPEndponintHostname; | ||
| private File privateKey; | ||
| private File publicCert; | ||
| private File idPMetadataFile; | ||
| private String signatureValidationType; | ||
| private Properties optionalProperties; | ||
| private Map<String, String> sites; | ||
|
|
||
| private IdpConfig() { | ||
| } | ||
|
|
||
| public static class Builder { | ||
| private IdpConfig idpConfigToBuild; | ||
|
|
||
| Builder() { | ||
| idpConfigToBuild = new IdpConfig(); | ||
| } | ||
|
|
||
| IdpConfig build() { | ||
| IdpConfig builtIdpConfig = idpConfigToBuild; | ||
| idpConfigToBuild = new IdpConfig(); | ||
|
|
||
| return builtIdpConfig; | ||
| } | ||
|
|
||
| public Builder id(String id) { | ||
| this.idpConfigToBuild.id = id; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder idpName(String idpName) { | ||
| this.idpConfigToBuild.idpName = idpName; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder enabled(boolean enabled) { | ||
| this.idpConfigToBuild.enabled = enabled; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder sPIssuerURL(String sPIssuerURL) { | ||
| this.idpConfigToBuild.sPIssuerURL = sPIssuerURL; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder sPEndponintHostname(String sPEndponintHostname) { | ||
| this.idpConfigToBuild.sPEndponintHostname = sPEndponintHostname; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder privateKey(File privateKey) { | ||
| this.idpConfigToBuild.privateKey = privateKey; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder publicCert(File publicCert) { | ||
| this.idpConfigToBuild.publicCert = publicCert; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder idPMetadataFile(File idPMetadataFile) { | ||
| this.idpConfigToBuild.idPMetadataFile = idPMetadataFile; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder signatureValidationType(String signatureValidationType) { | ||
| this.idpConfigToBuild.signatureValidationType = signatureValidationType; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder optionalProperties(Properties optionalProperties) { | ||
| this.idpConfigToBuild.optionalProperties = optionalProperties; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder sites(Map<String, String> sites) { | ||
| this.idpConfigToBuild.sites = sites; | ||
| return this; | ||
| } | ||
| } | ||
|
|
||
| public static IdpConfig.Builder convertIdpConfigToBuilder(IdpConfig idpConfig){ | ||
| IdpConfig.Builder builder = new IdpConfig.Builder(); | ||
|
|
||
| builder.id(idpConfig.getId()) | ||
| .idpName(idpConfig.getIdpName()) | ||
| .enabled(idpConfig.isEnabled()) | ||
| .sPIssuerURL(idpConfig.getsPIssuerURL()) | ||
| .sPEndponintHostname(idpConfig.getsPEndponintHostname()) | ||
| .privateKey(idpConfig.getPrivateKey()) | ||
| .publicCert(idpConfig.getPublicCert()) | ||
| .idPMetadataFile(idpConfig.getIdPMetadataFile()) | ||
| .signatureValidationType(idpConfig.getSignatureValidationType()) | ||
| .optionalProperties(idpConfig.getOptionalProperties()) | ||
| .sites(idpConfig.getSites()); | ||
|
|
||
| return builder; | ||
| } | ||
|
|
||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getIdpName() { | ||
| return idpName; | ||
| } | ||
|
|
||
| public boolean isEnabled() { | ||
| return enabled; | ||
| } | ||
|
|
||
| public String getsPIssuerURL() { | ||
| return sPIssuerURL; | ||
| } | ||
|
|
||
| public String getsPEndponintHostname() { | ||
| return sPEndponintHostname; | ||
| } | ||
|
|
||
| public File getPrivateKey() { | ||
| return privateKey; | ||
| } | ||
|
|
||
| public File getPublicCert() { | ||
| return publicCert; | ||
| } | ||
|
|
||
| public File getIdPMetadataFile() { | ||
| return idPMetadataFile; | ||
| } | ||
|
|
||
| public String getSignatureValidationType() { | ||
| return signatureValidationType; | ||
| } | ||
|
|
||
| public Properties getOptionalProperties() { | ||
| return optionalProperties; | ||
| } | ||
|
|
||
| public Map<String, String> getSites() { | ||
| return sites; | ||
| } | ||
|
|
||
| private String getSearchable() { | ||
| StringBuilder sb = new StringBuilder(); | ||
|
|
||
| //config name. | ||
| sb.append(this.idpName); | ||
| sb.append(" "); | ||
| //SP Issuer URL. | ||
| sb.append(this.sPIssuerURL); | ||
| sb.append(" "); | ||
| //SP Endpoint Hostname. | ||
| sb.append(this.sPEndponintHostname); | ||
| sb.append(" "); | ||
| //sites related to the IdP. | ||
| for (Map.Entry<String, String> entry : this.sites.entrySet()) { | ||
| sb.append(entry.getKey()); | ||
| sb.append(" "); | ||
| sb.append(entry.getValue()); | ||
| sb.append(" "); | ||
| } | ||
| //any override parameter. | ||
| sb.append(this.optionalProperties); | ||
|
|
||
| return sb.toString(); | ||
| } | ||
|
|
||
| public boolean contains(String string) { | ||
| return getSearchable().toLowerCase().contains(string.trim().toLowerCase()); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| IdpConfig idpConfig = (IdpConfig) o; | ||
| return Objects.equals(id, idpConfig.id); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
|
|
||
| return Objects.hash(id); | ||
| } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
src/com/dotcms/plugin/saml/v3/rest/api/v1/IdpConfigComparator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.dotcms.plugin.saml.v3.rest.api.v1; | ||
|
|
||
| import java.util.Comparator; | ||
|
|
||
| public class IdpConfigComparator implements Comparator<IdpConfig>{ | ||
|
|
||
| @Override | ||
| public int compare(IdpConfig idpConfig1, IdpConfig idpConfig2) { | ||
| return idpConfig1.getIdpName().compareToIgnoreCase(idpConfig2.getIdpName()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why it is not a immutable bean