Siteminder integartion Problem in 4.1
Asked by Mahipal Reddy:

We are using the site minder authentication in confluence 4.1 now we are trying to use same in confluence 4.3.

<br />

we found couple of classes changed in the confluence4.3 for authentication  
so that we are getting run time errors.

We are using below method:

```
if (existingSession != null &amp;&amp; existingSession.getAttribute(DefaultAuthenticator.LOGGED_IN_KEY) != null)        {        	        	log.info("in method 3");       Principal loggedInUser= (Principal) existingSession.getAttribute(DefaultAuthenticator.LOGGED_IN_KEY);                        //log.info("{} is already logged in."+ loggedInUser.getName());            return  loggedInUser;        }
```

We are getting the ClassCastException

Cause  

```
java.lang.ClassCastException: com.atlassian.confluence.user.SessionSafePrincipal cannot be cast to com.atlassian.user.User    at com.atlassian.confluence.user.AuthenticatedUserThreadLocal.getUser(AuthenticatedUserThreadLocal.java:25)Stack Trace:[hide]java.lang.ClassCastException: com.atlassian.confluence.user.SessionSafePrincipal cannot be cast to com.atlassian.user.User	at com.atlassian.confluence.user.AuthenticatedUserThreadLocal.getUser(AuthenticatedUserThreadLocal.java:25)	at com.atlassian.confluence.util.UserThreadLocalFilter.doFilter(UserThreadLocalFilter.java:36)	at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)	at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:211)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)	at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98)	at com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:30)	at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)	at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:150)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)	erInternal(GzipFilter.java:74)
```


Answers:
author: Mahipal Reddy
body: Thank you peter.

How we will get all Active directory and Ldap users information from "UserDirectories"

what is the bean name we need to use.

```
private DirectoryManager getDirectoryManager()    {    	        if (directoryManager == null)            directoryManager = (DirectoryManager) ContainerManager.getInstance().getContainerContext().getComponent("directoryManager");       // System.out.println("getDirectoryManager...2"+directoryManager);        return directoryManager;    }
```


author: PeterKoczan
body: Hi,

One of our customers ran into the same problem and published his findings on [this answers thread](/questions/104474/what-changes-are-needed-to-a-2-8-custom-authenticator-to-run-in-4-3). I suggest that you review it and see if the information there is useful for you.

Kind regards,

Peter


Tags: siteminder