final ObjectAction loginAction = MethodsUtils.findAction(object, loginMethodName);
final int parameterCount = loginAction.getParameterCount();
final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];
List<ObjectActionParameter> parameters2 = loginAction.getParameters();
if (parameters.length != 2) {
throw new ScimpiException("Expected two parameters for the log-on method: " + loginMethodName);
}
Localization localization = IsisContext.getLocalization();
ParseableFacet facet = parameters2.get(0).getSpecification().getFacet(ParseableFacet.class);
parameters[0] = facet.parseTextEntry(null, username, localization);
facet = parameters2.get(1).getSpecification().getFacet(ParseableFacet.class);
parameters[1] = facet.parseTextEntry(null, password, localization);
final ObjectAdapter result = loginAction.execute(object, parameters);
isValid = result != null;
if (isValid) {
ObjectSpecification specification = result.getSpecification();
ObjectAssociation association = specification.getAssociation(roleFieldName);
if (association == null) {
throw new ScimpiException("Expected a role name field called: " + roleFieldName);
}
ObjectAdapter role = association.get(result);
List<String> roles = new ArrayList<String>();
if (role != null) {
String[] split = role.titleString().split("\\|");