You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:18:08 UTC

[sling-org-apache-sling-auth-form] 24/32: SLING-1647 Set handler specific properties in the AuthenticationInfo instead of the credentials. The properties will be transferred to the session by the ResourceResolverFactory implementation

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.auth.form-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-form.git

commit 008d39dfea7df5467fe34e12964ac28356ff68a4
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Aug 12 13:52:24 2010 +0000

    SLING-1647 Set handler specific properties in the AuthenticationInfo instead of the credentials. The properties will be transferred to the session by the ResourceResolverFactory implementation
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/formauth@984778 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/formauth/impl/FormAuthenticationHandler.java   | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/formauth/impl/FormAuthenticationHandler.java b/src/main/java/org/apache/sling/formauth/impl/FormAuthenticationHandler.java
index 197bcef..1e9663b 100644
--- a/src/main/java/org/apache/sling/formauth/impl/FormAuthenticationHandler.java
+++ b/src/main/java/org/apache/sling/formauth/impl/FormAuthenticationHandler.java
@@ -592,7 +592,7 @@ public class FormAuthenticationHandler extends AbstractAuthenticationHandler {
             final AuthenticationInfo authInfo) {
 
         // get current authentication data, may be missing after first login
-        String authData = getCookieAuthData((Credentials)authInfo.get(AuthenticationInfo.CREDENTIALS));
+        String authData = getCookieAuthData(authInfo);
 
         // check whether we have to "store" or create the data
         final boolean refreshCookie = needsRefresh(authData,
@@ -660,17 +660,21 @@ public class FormAuthenticationHandler extends AbstractAuthenticationHandler {
             return null;
         }
 
-        final SimpleCredentials cookieAuthCredentials = new SimpleCredentials(
-            userId, new char[0]);
-        cookieAuthCredentials.setAttribute(attrCookieAuthData, authData);
-
         final AuthenticationInfo info = new AuthenticationInfo(
             HttpServletRequest.FORM_AUTH, userId);
-        info.put(AuthenticationInfo.CREDENTIALS, cookieAuthCredentials);
+        info.put(attrCookieAuthData, authData);
 
         return info;
     }
 
+    private String getCookieAuthData(final AuthenticationInfo info) {
+        Object data = info.get(attrCookieAuthData);
+        if (data instanceof String) {
+            return (String) data;
+        }
+        return null;
+    }
+
     // ---------- LoginModulePlugin support
 
     private String getCookieAuthData(final Credentials credentials) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.