Reputation: 83
I'm writing a simple custom user store manager for wso2is.
this is the code:
public class CustomJDBCUserStoreManager extends JDBCUserStoreManager {
private static Log log = LogFactory.getLog(CustomJDBCUserStoreManager.class);
public CustomJDBCUserStoreManager() {
}
public CustomJDBCUserStoreManager(org.wso2.carbon.user.api.RealmConfiguration realmConfig,
Map<String, Object> properties,
ClaimManager claimManager,
ProfileConfigurationManager profileManager,
UserRealm realm, Integer tenantId)
throws UserStoreException {
super(realmConfig, properties, claimManager, profileManager, realm, tenantId, false);
}
@Override
public void doAddUser(String userName, Object credential, String[] roleList,
Map<String, String> claims, String profileName,
boolean requirePasswordChange) throws UserStoreException {
String[] users = super.doListUsers( "*", -1);
int nUser = users.length;
if (nUser > 5){
throw new UserStoreException( "Reached the maximum number of global users" );
}else{
super.doAddUser( userName, credential, roleList, claims, profileName, requirePasswordChange );
}
}
}
The code work. When i try to insert from interface a number of user > 5, the interface give me the Exception message "Reached the maximum number of global users".
But when I try to add a user by SCIM over the 5 user I have the message:
{"Errors":[{"description":"Error in adding the user: mrossi to the user store..","code":"500"}]}
Well, in this point I need to get the correct message exception "Reached the maximum number of global users" and not a generic message "Error in adding the user".
Is there a way to do it?
thanks.
Upvotes: 0
Views: 148
Reputation: 799
If you have problems with building particular component. You can try it [a] Identity Server next release.
build it with maven and you can find distribution inside "product-is/modules/distribution/target".
[a] https://github.com/wso2/product-is/
Upvotes: 1
Reputation: 799
Please refer below link [1]. In SCIMUserManager class line 159 change "Error in adding the user: " + user.getUserName() + " to the user store.." to e.getMessage() and replace wso2.war in repository/deployment/server/webapps also delete wso2 directory
Upvotes: 0
Reputation: 799
You need to do little code modification to SCIM provider component. What is the version of WSO2 Identity Server you are using so that I can point you
Upvotes: 0