Hi,
I'm trying to implement the above scenario using the Identity Server and a
simple Java client. I've enabled the following in the
identity-mgt.properties.
Identity.Listener.Enable=true
Notification.Sending.Enable=true
Notification.Expire.Time=7200
Notification.Sending.Internally.Managed=true
UserAccount.Verification.Enable=false
Authentication.Policy.Enable=true
Authentication.Policy.Account.Lock.On.Creation=true
Authentication.Policy.Account.Lock.Time=0
Authentication.Policy.Account.Lock.On.Failure=false
Authentication.Policy.Account.Lock.On.Failure.Max.Attempts=0
I have the axis2.xml configured with the mailto transportSender as follows.
<transportSender name="mailto"
class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.from">[email protected]</parameter>
<parameter name="mail.smtp.user">chtest00001</parameter>
<parameter name="mail.smtp.password">mailpassword</parameter>
<parameter name="mail.smtp.host">smtp.gmail.com</parameter>
<parameter name="mail.smtp.port">587</parameter>
<parameter name="mail.smtp.starttls.enable">true</parameter>
<parameter name="mail.smtp.auth">true</parameter>
</transportSender>
I've attached the Java code that I'm using the register the user.
When executing the service call, I get the following error message, which
is not descriptive, and there is nothing in the Carbon console except for
the log entries related to user entry. This occurs in both IS 5.0.0 and IS
4.5.0.
VerificationBean verificationBean = *stub.registerUser(userName, password,
claims, null, null);*
Result
=====
org.wso2.carbon.identity.mgt.stub.UserInformationRecoveryServiceIdentityMgtServiceExceptionException:
UserInformationRecoveryServiceIdentityMgtServiceExceptionException
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 java.lang.Class.newInstance(Class.java:374)
at
org.wso2.carbon.identity.mgt.stub.UserInformationRecoveryServiceStub.registerUser(UserInformationRecoveryServiceStub.java:685)
at org.chamilad.test.is.UserRegistration.main(UserRegistration.java:78)
Carbon console
===========
[2014-12-03 22:51:46,868] WARN
{org.wso2.carbon.server.admin.module.handler.AuthenticationHandler} -
Illegal access attempt at [2014-12-03 22:51:46,0868] from IP address
127.0.0.1 while trying to authenticate access to service
UserInformationRecoveryService
[2014-12-03 22:51:46,888] DEBUG
{org.wso2.carbon.identity.mgt.IdentityMgtEventListener} - Pre
authenticator is called in IdentityMgtEventListener
[2014-12-03 22:51:46,916] DEBUG
{org.wso2.carbon.identity.mgt.IdentityMgtEventListener} - Post
authenticator is called in IdentityMgtEventListener
[2014-12-03 22:51:46,918] INFO
{org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -
'[email protected] [-1234]' logged in at [2014-12-03 22:51:46,918+0530]
[2014-12-03 22:51:46,919] DEBUG {org.wso2.carbon.identity.mgt.util.Utils} -
Domain is not defined implicitly. So it is Super Tenant domain.
[2014-12-03 22:51:46,922] DEBUG
{org.wso2.carbon.identity.mgt.IdentityMgtEventListener} - Pre add user is
called in IdentityMgtEventListener
[2014-12-03 22:51:46,988] DEBUG
{org.wso2.carbon.identity.mgt.IdentityMgtEventListener} - Post add user is
called in IdentityMgtEventListener
I tried debugging the server side code, but for both version 4.2.0 and
4.2.1 of org.wso2.carbon.identity.mgt, the debug pointers point to
incorrect locations in the source. So I can't really pinpoint from where
the IdentityMgtServiceException comes. However it is possible this might be
related to the user store, the default LDAP user store that ships with IS,
since the error comes as a UserStoreException as far as I assume.
Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com
package org.chamilad.test.is;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.wso2.carbon.identity.mgt.stub.UserInformationRecoveryServiceIdentityMgtServiceExceptionException;
import org.wso2.carbon.identity.mgt.stub.UserInformationRecoveryServiceStub;
import org.wso2.carbon.identity.mgt.stub.beans.VerificationBean;
import org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO;
import java.rmi.RemoteException;
import java.util.Map;
import java.util.Properties;
public class UserRegistration {
public static void main(String[] args) {
UserInformationRecoveryServiceStub stub = null;
HttpTransportProperties.Authenticator authenticator = null;
Map properties = null;
String serviceUrl = "https://localhost:9443/services/UserInformationRecoveryService";
try {
System.setProperty("javax.net.ssl.trustStore",
"<WSO2-IS-5.0.0-HOME>/repository/resources/security/client-truststore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
stub = new UserInformationRecoveryServiceStub(null, serviceUrl);
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
authenticator = new HttpTransportProperties.Authenticator();
authenticator.setUsername("admin");
authenticator.setPassword("admin");
properties = new Properties();
properties.put(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator);
options.setProperties(properties);
} catch (AxisFault axisFault) {
System.out.println(axisFault.getMessage());
axisFault.printStackTrace();
}
String userName = "chamilad";
String password = "00998877T@s";
// String password = "";
String emailaddress = "[email protected]";
String givenname = "chamila";
String lastname = "de alwis";
String organization = "wso2";
if (stub != null) {
try {
UserIdentityClaimDTO claimEmailaddress = new UserIdentityClaimDTO();
claimEmailaddress.setClaimUri("http://wso2.org/claims/emailaddress");
claimEmailaddress.setClaimValue(emailaddress);
UserIdentityClaimDTO claimGivenname = new UserIdentityClaimDTO();
claimGivenname.setClaimUri("http://wso2.org/claims/givenname");
claimGivenname.setClaimValue(givenname);
UserIdentityClaimDTO claimLastname = new UserIdentityClaimDTO();
claimLastname.setClaimUri("http://wso2.org/claims/lastname");
claimLastname.setClaimValue(lastname);
UserIdentityClaimDTO claimOrganization = new UserIdentityClaimDTO();
claimOrganization.setClaimUri("http://wso2.org/claims/organization");
claimOrganization.setClaimValue(organization);
UserIdentityClaimDTO claims[] = new UserIdentityClaimDTO[]{claimEmailaddress, claimGivenname, claimLastname, claimOrganization};
VerificationBean verificationBean = stub.registerUser(userName, password, claims, null, null);
// VerificationBean verificationBean1 = stub.registerUser()
System.out.println("Successfully Registered the User -" + verificationBean.getUserId() + " Verification Key -" + verificationBean.getKey());
} catch (UserInformationRecoveryServiceIdentityMgtServiceExceptionException e) {
System.out.println(e.getMessage());
System.out.println(e.getFaultMessage());
e.printStackTrace();
} catch (RemoteException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
} else {
System.out.println("Internal Error - Stub Creation Failed");
}
}
}
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev