Skip to content

Commit

Permalink
ClearPassUserCasAuthenticatorService example on drives.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
vbonamy committed Mar 29, 2018
1 parent 99acb39 commit c6c2b44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS

package org.esupportail.portlet.filemanager.services.auth.cas;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.spec.PKCS8EncodedKeySpec;
Expand Down Expand Up @@ -76,7 +79,8 @@ public void initialize(SharedUserPortletParameters userParameters) {

public void setPkcs8Key(String pkcs8Key) throws Exception {
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
privateKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(pkcs8Key.getBytes()));
Path pkcs8KeyPath = Paths.get(pkcs8Key);
privateKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(Files.readAllBytes(pkcs8KeyPath)));
}

public UserPassword getUserPassword(SharedUserPortletParameters userParameters) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/webapp/WEB-INF/context/drives.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@
<property name="target" value="sftp://stock-2.mon-univ.fr"/>
</bean>

<!-- if you want to use clearPass (CAS V5) use instead this casUserAuthenticationService
<bean name="casUserAuthenticationService" class="org.esupportail.portlet.filemanager.services.auth.cas.ClearPassUserCasAuthenticatorService">
<property name="userCasAuthenticatorServiceRoot" ref="casUserAuthenticationServiceRoot"/>
<property name="pkcs8Key" value="/etc/cas/config/security/private.p8"/>
</bean>
-->

<!-- note casUserAuthenticationServiceRoot, casService, ticketValidator, ticketValidationFilter proxyGrantingTicketStorage and are sufficient for more than one drive-->

<bean name="casUserAuthenticationServiceRoot" class="org.esupportail.portlet.filemanager.services.auth.cas.UserCasAuthenticatorServiceRoot">
Expand Down

0 comments on commit c6c2b44

Please sign in to comment.