jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1412897 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/security/ main/java/org/apache/jackrabbit/oak/security/authentication/ main/java/org/apache/jackrabbit/oak/secur...
Date Fri, 23 Nov 2012 14:18:06 GMT
Author: angela
Date: Fri Nov 23 14:18:03 2012
New Revision: 1412897

URL: http://svn.apache.org/viewvc?rev=1412897&view=rev
Log:
OAK-91 : Implement Authentication Support  (work in progress)

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
  (contents, props changed)
      - copied, changed from r1412883, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenLoginContextProvider.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenLoginContextProvider.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenDefaultLoginModuleTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Fri Nov 23 14:18:03 2012
@@ -85,7 +85,7 @@ public class ContentRepositoryImpl imple
             throw new NoSuchWorkspaceException(workspaceName);
         }
 
-        LoginContextProvider lcProvider = securityProvider.getLoginContextProvider(nodeStore,
indexProvider);
+        LoginContextProvider lcProvider = securityProvider.getAuthenticationConfiguration().getLoginContextProvider(nodeStore,
indexProvider);
         LoginContext loginContext = lcProvider.getLoginContext(credentials, workspaceName);
         loginContext.login();
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
Fri Nov 23 14:18:03 2012
@@ -19,26 +19,20 @@ package org.apache.jackrabbit.oak.securi
 import java.util.HashSet;
 import java.util.Set;
 import javax.annotation.Nonnull;
-import javax.security.auth.login.Configuration;
 
-import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.security.authentication.LoginContextProviderImpl;
-import org.apache.jackrabbit.oak.security.authentication.token.TokenProviderImpl;
+import org.apache.jackrabbit.oak.security.authentication.AuthenticationConfigurationImpl;
 import org.apache.jackrabbit.oak.security.authorization.AccessControlConfigurationImpl;
 import org.apache.jackrabbit.oak.security.principal.PrincipalConfigurationImpl;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeConfigurationImpl;
 import org.apache.jackrabbit.oak.security.user.UserConfigurationImpl;
-import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,12 +40,9 @@ public class SecurityProviderImpl implem
 
     private static final Logger log = LoggerFactory.getLogger(SecurityProviderImpl.class);
 
-    public static final String PARAM_APP_NAME = "org.apache.jackrabbit.oak.auth.appName";
-    private static final String DEFAULT_APP_NAME = "jackrabbit.oak";
-
+    public static final String PARAM_AUTHENTICATION_OPTIONS = "org.apache.jackrabbit.oak.authentication.options";
     public static final String PARAM_PRINCIPAL_OPTIONS = "org.apache.jackrabbit.oak.principal.options";
     public static final String PARAM_USER_OPTIONS = "org.apache.jackrabbit.oak.user.options";
-    public static final String PARAM_TOKEN_OPTIONS = "org.apache.jackrabbit.oak.token.options";
 
     private final ConfigurationParameters configuration;
 
@@ -76,23 +67,8 @@ public class SecurityProviderImpl implem
 
     @Nonnull
     @Override
-    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider) {
-        String appName = configuration.getConfigValue(PARAM_APP_NAME, DEFAULT_APP_NAME);
-        Configuration loginConfig;
-        try {
-            loginConfig = Configuration.getConfiguration();
-        } catch (SecurityException e) {
-            log.warn("Failed to retrieve login configuration: using default.", e);
-            loginConfig = new OakConfiguration(configuration); // TODO: define configuration
structure
-            Configuration.setConfiguration(loginConfig);
-        }
-        return new LoginContextProviderImpl(appName, loginConfig, nodeStore, indexProvider,
this);
-    }
-
-    @Nonnull
-    @Override
-    public TokenProvider getTokenProvider(Root root) {
-        return new TokenProviderImpl(root, getOptions(PARAM_TOKEN_OPTIONS), getUserConfiguration());
+    public AuthenticationConfiguration getAuthenticationConfiguration() {
+        return new AuthenticationConfigurationImpl(this, getOptions(PARAM_AUTHENTICATION_OPTIONS));
     }
 
     @Nonnull

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java?rev=1412897&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
Fri Nov 23 14:18:03 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.security.authentication;
+
+import javax.annotation.Nonnull;
+import javax.security.auth.login.Configuration;
+
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.security.OakConfiguration;
+import org.apache.jackrabbit.oak.security.authentication.token.TokenProviderImpl;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
+import org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * AuthenticationConfigurationImpl... TODO
+ */
+public class AuthenticationConfigurationImpl extends SecurityConfiguration.Default implements
AuthenticationConfiguration {
+
+    private static final Logger log = LoggerFactory.getLogger(AuthenticationConfigurationImpl.class);
+
+    public static final String PARAM_APP_NAME = "org.apache.jackrabbit.oak.auth.appName";
+    private static final String DEFAULT_APP_NAME = "jackrabbit.oak";
+
+    public static final String PARAM_TOKEN_OPTIONS = "org.apache.jackrabbit.oak.token.options";
+
+    private final SecurityProvider securityProvider;
+    private final ConfigurationParameters options;
+
+    public AuthenticationConfigurationImpl(SecurityProvider securityProvider, ConfigurationParameters
options) {
+        this.securityProvider = securityProvider;
+        this.options = options;
+    }
+
+    @Nonnull
+    @Override
+    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider) {
+        String appName = options.getConfigValue(PARAM_APP_NAME, DEFAULT_APP_NAME);
+        Configuration loginConfig;
+        try {
+            loginConfig = Configuration.getConfiguration();
+        } catch (SecurityException e) {
+            log.warn("Failed to retrieve login configuration: using default.", e);
+            loginConfig = new OakConfiguration(options); // TODO: define configuration structure
+            Configuration.setConfiguration(loginConfig);
+        }
+        return new LoginContextProviderImpl(appName, loginConfig, nodeStore, indexProvider,
securityProvider);
+    }
+
+    @Nonnull
+    @Override
+    public TokenProvider getTokenProvider(Root root) {
+        ConfigurationParameters tokenOptions = options.getConfigValue(PARAM_TOKEN_OPTIONS,
new ConfigurationParameters());
+        return new TokenProviderImpl(root, tokenOptions, securityProvider.getUserConfiguration());
+    }
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
Fri Nov 23 14:18:03 2012
@@ -211,7 +211,7 @@ public final class TokenLoginModule exte
         SecurityProvider securityProvider = getSecurityProvider();
         Root root = getRoot();
         if (root != null && securityProvider != null) {
-            provider = securityProvider.getTokenProvider(root);
+            provider = securityProvider.getAuthenticationConfiguration().getTokenProvider(root);
         }
         if (provider == null && callbackHandler != null) {
             try {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
Fri Nov 23 14:18:03 2012
@@ -19,17 +19,13 @@ package org.apache.jackrabbit.oak.spi.se
 import java.util.Collections;
 import javax.annotation.Nonnull;
 
-import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.OpenLoginContextProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authentication.OpenAuthenticationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.OpenAccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * OpenSecurityProvider... TODO: review if we really have the need for that once TODO in
InitialContent is resolved
@@ -44,14 +40,8 @@ public class OpenSecurityProvider implem
 
     @Nonnull
     @Override
-    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider) {
-        return new OpenLoginContextProvider();
-    }
-
-    @Nonnull
-    @Override
-    public TokenProvider getTokenProvider(Root root) {
-        throw new UnsupportedOperationException();
+    public AuthenticationConfiguration getAuthenticationConfiguration() {
+        return new OpenAuthenticationConfiguration();
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
Fri Nov 23 14:18:03 2012
@@ -18,15 +18,11 @@ package org.apache.jackrabbit.oak.spi.se
 
 import javax.annotation.Nonnull;
 
-import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
-import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * SecurityProvider... TODO
@@ -36,12 +32,8 @@ public interface SecurityProvider {
     @Nonnull
     Iterable<SecurityConfiguration> getSecurityConfigurations();
 
-    // TODO review again
     @Nonnull
-    LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider);
-
-    @Nonnull
-    TokenProvider getTokenProvider(Root root);
+    AuthenticationConfiguration getAuthenticationConfiguration();
 
     @Nonnull
     AccessControlConfiguration getAccessControlConfiguration();

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java?rev=1412897&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java
Fri Nov 23 14:18:03 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.security.authentication;
+
+import javax.annotation.Nonnull;
+
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+
+/**
+ * AuthenticationConfiguration... TODO
+ */
+public interface AuthenticationConfiguration extends SecurityConfiguration {
+
+    // TODO review again
+    @Nonnull
+    LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider);
+
+    @Nonnull
+    TokenProvider getTokenProvider(Root root);
+}
\ No newline at end of file

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
(from r1412883, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenLoginContextProvider.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenLoginContextProvider.java&r1=1412883&r2=1412897&rev=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenLoginContextProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
Fri Nov 23 14:18:03 2012
@@ -20,34 +20,52 @@ import javax.annotation.Nonnull;
 import javax.jcr.Credentials;
 import javax.security.auth.Subject;
 
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+
 /**
- * This class provides login contexts that accept any credentials and doesn't
- * validate specified workspace name.
+ * This implementation of the authentication configuration provides login
+ * contexts that accept any credentials and doesn't validate specified
+ * workspace name. Retrieving a {@code TokenProvider} is not supported.
  */
-public class OpenLoginContextProvider implements LoginContextProvider {
+public class OpenAuthenticationConfiguration extends SecurityConfiguration.Default implements
AuthenticationConfiguration {
 
-    @Override
     @Nonnull
-    public LoginContext getLoginContext(final Credentials credentials, String workspaceName)
{
-        return new LoginContext() {
-            @Override
-            public Subject getSubject() {
-                Subject subject = new Subject();
-                if (credentials != null) {
-                    subject.getPrivateCredentials().add(credentials);
-                }
-                subject.setReadOnly();
-                return subject;
-            }
-            @Override
-            public void login() {
-                // do nothing
-            }
+    @Override
+    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider) {
+        return new LoginContextProvider() {
+            @Nonnull
             @Override
-            public void logout() {
-                // do nothing
+            public LoginContext getLoginContext(final Credentials credentials, String workspaceName)
{
+                return new LoginContext() {
+                    @Override
+                    public Subject getSubject() {
+                        Subject subject = new Subject();
+                        if (credentials != null) {
+                            subject.getPrivateCredentials().add(credentials);
+                        }
+                        subject.setReadOnly();
+                        return subject;
+                    }
+                    @Override
+                    public void login() {
+                        // do nothing
+                    }
+                    @Override
+                    public void logout() {
+                        // do nothing
+                    }
+                };
             }
         };
     }
 
+    @Nonnull
+    @Override
+    public TokenProvider getTokenProvider(Root root) {
+        throw new UnsupportedOperationException();
+    }
 }

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenDefaultLoginModuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenDefaultLoginModuleTest.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenDefaultLoginModuleTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenDefaultLoginModuleTest.java
Fri Nov 23 14:18:03 2012
@@ -187,7 +187,7 @@ public class TokenDefaultLoginModuleTest
     @Test
     public void testValidTokenCredentials() throws Exception {
         Root root = admin.getLatestRoot();
-        TokenProvider tp = getSecurityProvider().getTokenProvider(root);
+        TokenProvider tp = getSecurityProvider().getAuthenticationConfiguration().getTokenProvider(root);
 
         SimpleCredentials sc = (SimpleCredentials) getAdminCredentials();
         TokenInfo info = tp.createToken(sc.getUserID(), Collections.<String, Object>emptyMap());

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java?rev=1412897&r1=1412896&r2=1412897&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/TokenLoginModuleTest.java
Fri Nov 23 14:18:03 2012
@@ -137,7 +137,7 @@ public class TokenLoginModuleTest extend
     @Test
     public void testValidTokenCredentials() throws Exception {
         Root root = admin.getLatestRoot();
-        TokenProvider tp = getSecurityProvider().getTokenProvider(root);
+        TokenProvider tp = getSecurityProvider().getAuthenticationConfiguration().getTokenProvider(root);
 
         SimpleCredentials sc = (SimpleCredentials) getAdminCredentials();
         TokenInfo info = tp.createToken(sc.getUserID(), Collections.<String, Object>emptyMap());



Mime
View raw message