java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User

Apereo Issues | Ivan Goonich | 6 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Dear Scott, In atlassian-seraph-2.5.0 (included in JIRA 4.3.4, in previous version was atlassian-seraph-2.5.0-m3) the implementation of "DefaultAuthenticator" has changed. Namely, the following code was changed in the "login" method in: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0)|borderStyle=solid} ... final String METHOD = "login : "; final boolean dbg = log.isDebugEnabled(); final Principal principal = new Principal() { public String getName() { return userName; } }; final boolean authenticated = authenticate(principal, password); ... {code} And in the previous version was: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0-m3)|borderStyle=solid} ... final Principal user = getUser(userName); if (user == null) { log.info(METHOD + "'" + userName + "' does not exist and cannot be authenticated."); } else { final boolean authenticated = authenticate(user, password); ... {code} As a result current implementation of "JiraCasAuthenticator#authenticate" fails with ClassCastException: {code:title=JiraCasAuthenticator.java|borderStyle=solid} ... @Override protected boolean authenticate(final Principal principal, final String password) throws AuthenticatorException { return ((User) principal).authenticate(password); } ... {code} Stack trace: {noformat} java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User at org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate(JiraCasAuthenticator.java:55) at com.atlassian.seraph.auth.DefaultAuthenticator.login(DefaultAuthenticator.java:94) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.runAuthentication(PasswordBasedLoginFilter.java:127) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.login(PasswordBasedLoginFilter.java:72) at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:130) at com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) {noformat} Best regards, Ivan Goonich eVelopers, Corp.

    Apereo Issues | 6 years ago | Ivan Goonich
    java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User
  2. 0

    Dear Scott, In atlassian-seraph-2.5.0 (included in JIRA 4.3.4, in previous version was atlassian-seraph-2.5.0-m3) the implementation of "DefaultAuthenticator" has changed. Namely, the following code was changed in the "login" method in: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0)|borderStyle=solid} ... final String METHOD = "login : "; final boolean dbg = log.isDebugEnabled(); final Principal principal = new Principal() { public String getName() { return userName; } }; final boolean authenticated = authenticate(principal, password); ... {code} And in the previous version was: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0-m3)|borderStyle=solid} ... final Principal user = getUser(userName); if (user == null) { log.info(METHOD + "'" + userName + "' does not exist and cannot be authenticated."); } else { final boolean authenticated = authenticate(user, password); ... {code} As a result current implementation of "JiraCasAuthenticator#authenticate" fails with ClassCastException: {code:title=JiraCasAuthenticator.java|borderStyle=solid} ... @Override protected boolean authenticate(final Principal principal, final String password) throws AuthenticatorException { return ((User) principal).authenticate(password); } ... {code} Stack trace: {noformat} java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User at org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate(JiraCasAuthenticator.java:55) at com.atlassian.seraph.auth.DefaultAuthenticator.login(DefaultAuthenticator.java:94) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.runAuthentication(PasswordBasedLoginFilter.java:127) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.login(PasswordBasedLoginFilter.java:72) at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:130) at com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) {noformat} Best regards, Ivan Goonich eVelopers, Corp.

    Apereo Issues | 6 years ago | Ivan Goonich
    java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User

      at org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate()
    2. org.jasig.cas
      JiraCasAuthenticator.authenticate
      1. org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate(JiraCasAuthenticator.java:55)
      1 frame
    3. com.atlassian.seraph
      BaseLoginFilter.doFilter
      1. com.atlassian.seraph.auth.DefaultAuthenticator.login(DefaultAuthenticator.java:94)
      2. com.atlassian.seraph.filter.PasswordBasedLoginFilter.runAuthentication(PasswordBasedLoginFilter.java:127)
      3. com.atlassian.seraph.filter.PasswordBasedLoginFilter.login(PasswordBasedLoginFilter.java:72)
      4. com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:130)
      4 frames
    4. com.atlassian.jira
      JiraLoginFilter.doFilter
      1. com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:70)
      1 frame
    5. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      2 frames