Index: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements.  See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License.  You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.apache.jackrabbit.oak.security.authentication;\n\nimport org.apache.jackrabbit.oak.api.ContentRepository;\nimport org.apache.jackrabbit.oak.security.principal.KernelPrincipalProvider;\nimport org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;\nimport org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport javax.jcr.Credentials;\nimport javax.security.auth.Subject;\nimport javax.security.auth.login.Configuration;\nimport javax.security.auth.login.LoginContext;\nimport javax.security.auth.login.LoginException;\nimport java.security.AccessController;\n\n/**\n * LoginContextProviderImpl...  TODO\n */\npublic class LoginContextProviderImpl implements LoginContextProvider {\n\n    private static final Logger log = LoggerFactory.getLogger(LoginContextProviderImpl.class);\n\n    private static final String APP_NAME = \"jackrabbit.oak\";\n\n    private final Configuration authConfig;\n    private final PrincipalProvider principalProvider;\n\n    public LoginContextProviderImpl(ContentRepository repository) {\n        // TODO: use configurable authentication config and principal provider\n        authConfig = new ConfigurationImpl();\n        principalProvider = new KernelPrincipalProvider();\n    }\n\n    @Override\n    public LoginContext getLoginContext(Credentials credentials, String workspaceName) throws LoginException {\n        // TODO: add proper implementation\n        // TODO  - authentication against configurable spi-authentication\n        // TODO  - validation of workspace name (including access rights for the given 'user')\n        Subject subject = getSubject();\n        return new LoginContext(APP_NAME, subject, new CallbackHandlerImpl(credentials, principalProvider), authConfig);\n    }\n\n    //-------------------------------------------------===--------< private >---\n    private Subject getSubject() {\n        Subject subject = null;\n        try {\n            subject = Subject.getSubject(AccessController.getContext());\n        } catch (SecurityException e) {\n            log.debug(\"Can't check for pre-authentication. Reason:\", e.getMessage());\n        }\n        if (subject == null) {\n            subject = new Subject();\n        }\n        return subject;\n    }\n}
===================================================================
--- oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java	(date 1344613995000)
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java	(revision )
@@ -54,7 +54,13 @@
         // TODO  - authentication against configurable spi-authentication
         // TODO  - validation of workspace name (including access rights for the given 'user')
         Subject subject = getSubject();
+        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        try{
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-        return new LoginContext(APP_NAME, subject, new CallbackHandlerImpl(credentials, principalProvider), authConfig);
+            return new LoginContext(APP_NAME, subject, new CallbackHandlerImpl(credentials, principalProvider), authConfig);
+        }finally{
+            Thread.currentThread().setContextClassLoader(cl);
+        }
     }
 
     //-------------------------------------------------===--------< private >---
\ No newline at end of file
