You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Håkon Sagehaug <Ha...@bccs.uib.no> on 2009/04/16 09:37:26 UTC

Class cast Exception, trying to create a own Token issuer

Hi all,

I'm trying to make my own little SAML issuer, that implements the
TokenIssuer class of rampart-trust. But when I call the service I get this
error

 java.lang.ClassCastException:
no.uib.bccs.esysbio.services.sts.EsysbioSAMLIssuer cannot be cast to
org.apache.rahas.TokenIssuer

even though my class implements TokenIssuer

public class EsysbioSAMLIssuer implements TokenIssuer {

    @Override
    public String getResponseAction(RahasData arg0) throws TrustException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public SOAPEnvelope issue(RahasData arg0) throws TrustException {
        System.out.println("Key size " + arg0.getKeysize());
        return null;
    }

    @Override
    public void setConfigurationElement(OMElement arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void setConfigurationFile(String arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void setConfigurationParamName(String arg0) {
        // TODO Auto-generated method stub

    }

}


My configuration of the issuer in service.xml looks like this

<parameter name="token-dispatcher-configuration">
                <token-dispatcher-configuration>
                    <!-- Issuers. You may have many issuers. -->
                    <issuer
class="no.uib.bccs.esysbio.services.sts.EsysbioSAMLIssuer"
default="true">
                        <tokenType>

http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1
                        </tokenType>
                    </issuer>
                </token-dispatcher-configuration>
            </parameter>

I looked at the rampart page for this and to me it looks the same, but I
guess there must be an error somewhere.

One possible reason for the error could be that, I need to have
rampart-trust.jar file in both tomcat/lib and axis2/WEB-INF/lib in my tomcat
web server. If I don't have this I get error about not finding certain
classes.

Does anyone have a good tip for me??

cheers, Håkon

-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)