Client SDK CreateIdentity not work.

This topic has 2 replies, 2 voices, and was last updated 7 years, 8 months ago by k.satou.

  • Author
    Posts
  • #3813
     k.satou
    Participant

    Hi all,

    I am trying to create a identity using OpenAM Client SDK 11.0.0.

    Here is the piece of code that I made so far:

    /**
    * Servlet implementation class CreateUser
    */
    public class CreateIdentityServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
    * @see HttpServlet#HttpServlet()
    */
    public CreateIdentityServlet() {
    super();
    // TODO Auto-generated constructor stub
    }

    /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ServletOutputStream out = null;

    // create the sso token from http request
    SSOTokenManager manager;
    try {
    manager = SSOTokenManager.getInstance();

    SSOToken token = manager.createSSOToken(request);

    if (manager.isValidToken(token)) {

    System.out.println(“CreateIdentity Start”);

    HashMap<String,Object> map = new HashMap<String,Object>();

    map.put(“userpassword”, new HashSet<String>().add(“test12345″));

    AMIdentityRepository amIr = new AMIdentityRepository(token,”/”);
    AMIdentity tmpId = amIr.createIdentity(IdType.USER, “CreateTest”, map);
    System.out.println(“CreateIdentity End”);
    }

    } catch (SSOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IdRepoException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    }

    }

    However the following exception is raises:

    Message:Minimum password length is 8.

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.sun.identity.shared.jaxrpc.SOAPClient$SOAPContentHandler.createResourceBasedException(SOAPClient.java:855)
    at com.sun.identity.shared.jaxrpc.SOAPClient$SOAPContentHandler.endDocument(SOAPClient.java:808)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:745)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:515)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
    at com.sun.identity.shared.jaxrpc.SOAPClient.send(SOAPClient.java:346)
    at com.sun.identity.shared.jaxrpc.SOAPClient.send(SOAPClient.java:315)
    at com.sun.identity.idm.remote.IdRemoteServicesImpl.create(IdRemoteServicesImpl.java:201)
    at com.sun.identity.idm.AMIdentityRepository.createIdentity(AMIdentityRepository.java:384)
    at com.sun.identity.samples.sso.CreateIdentityServlet.doGet(CreateIdentityServlet.java:69)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at com.sun.identity.setup.ClientConfiguratorFilter.doFilter(ClientConfiguratorFilter.java:92)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

    “userpassword” I have input is greater than or equal to 8 characters ,
    but “Message:Minimum password length is 8.” was displayed.
    What am I doing wrong?

    Thank you in advance.
    Regard.

    #3814
     Peter Major
    Moderator

    new HashSet().add(“test12345”); creates a mapping of
    userpassword -> true.

    Please read the JavaDoc of HashSet#add and also use generics in your custom code…

    #3822
     k.satou
    Participant

    Thank you, Peter!
    I should have been become more careful..

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?