Skip to content

Commit

Permalink
wttech#31:Preserved compatibility with AEM 6.1-6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Wesolowski committed Mar 6, 2019
1 parent 377f2a1 commit 0da7a2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.osgi</artifactId>
<version>2.4.0</version>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -278,7 +278,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.servlets.post</artifactId>
<version>2.3.24</version>
<version>2.3.6</version>
<scope>provided</scope>
</dependency><!-- https://mvnrepository.com/artifact/com.adobe.granite/com.adobe.granite.crypto -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.adobe.granite.crypto.CryptoException;
import com.adobe.granite.crypto.CryptoSupport;
import com.cognifide.secureaem.GlobalConfiguration;
import org.apache.commons.lang3.StringUtils;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.ConfigurationPolicy;
Expand Down Expand Up @@ -95,7 +96,7 @@ public String getAuthorLogin() {

@Override
public String getAuthorPassword() {
return authorPassowrd;
return getPassword(authorPassowrd);
}

@Override
Expand All @@ -110,7 +111,19 @@ public String getPublishLogin() {

@Override
public String getPublishPassword() {
return publishPassword;
return getPassword(publishPassword);
}


private String getPassword(String passwordToDecrypt) {
String password = StringUtils.defaultString(passwordToDecrypt);
if (cryptoSupport.isProtected(password)) {
try {
password = cryptoSupport.unprotect(password);
} catch (CryptoException e) {
LOGGER.error("Failed to decrypt password", e);
}
}
return password;
}
}

0 comments on commit 0da7a2c

Please sign in to comment.