use of org.mule.runtime.core.api.el.ExpressionManager in project mule by mulesoft.
the class UsernamePasswordAuthenticationFilter method getAuthenticationToken.
protected Authentication getAuthenticationToken(CoreEvent event) throws UnauthorisedException {
ExpressionManager expressionManager = (ExpressionManager) registry.lookupByName(OBJECT_EXPRESSION_MANAGER).get();
Object usernameEval = expressionManager.evaluate(username, event).getValue();
Object passwordEval = expressionManager.evaluate(password, event).getValue();
if (usernameEval == null) {
throw new UnauthorisedException(authNoCredentials());
}
if (passwordEval == null) {
throw new UnauthorisedException(authNoCredentials());
}
return new DefaultMuleAuthentication(new DefaultMuleCredentials(usernameEval.toString(), passwordEval.toString().toCharArray()));
}
Aggregations