Refine search
/** * {@inheritDoc} */ @Override public void setFunction(String prefix, Method method) { FunctionMapper functions = elContext.getFunctionMapper(); functions.mapFunction(prefix, method.getName(), method); }
@Override public Class getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null) { return this.fn1.resolveFunction(prefix, name); } return m; }
public Class getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null) { return this.fn1.resolveFunction(prefix, name); } return m; }
public Class getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null && this.fn1 != null) { return this.fn1.resolveFunction(prefix, name); } return m; }
/** * {@inheritDoc} */ @Override public void setFunction(String prefix, String name, Method method) { FunctionMapper functions = elContext.getFunctionMapper(); functions.mapFunction(prefix, name, method); }
public Class getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ @Override public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null) { return this.fn1.resolveFunction(prefix, name); } return m; }
/** * Maps a static method to an EL function. * @param prefix The namespace of the functions, can be "". * @param function The name of the function. * @param meth The static method to be invoked when the function is used. */ public void mapFunction(String prefix, String function, Method meth) { getELContext().getFunctionMapper().mapFunction(prefix, function, meth); }
@Override public Class<?> getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MESSAGES.missingFunctionMapper()); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MESSAGES.functionNotFound(this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ @Override public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null) { return this.fn1.resolveFunction(prefix, name); } return m; }
@Override public void executePolicy(String policyStatement, Errors.Collector collector, ProviderRequest request) { StandardELContext context = new StandardELContext(ef); context.addELResolver(ATTRIBUTE_RESOLVER); FunctionMapper functions = context.getFunctionMapper(); VariableMapper variables = context.getVariableMapper(); customMethods.forEach(customFunction -> functions.mapFunction(customFunction.prefix, customFunction.localName, customFunction.method)); Subject userSubject = request.subject().orElse(SecurityContext.ANONYMOUS); variable(variables, "user", userSubject, Subject.class); variable(variables, "subject", userSubject, Subject.class); variable(variables, "service", request.service().orElse(SecurityContext.ANONYMOUS), Subject.class); variable(variables, "env", request.env(), SecurityEnvironment.class); variable(variables, "object", request.getObject().orElse(null), Object.class); variable(variables, "request", request, ProviderRequest.class); try { ValueExpression expression = ef.createValueExpression(context, policyStatement, boolean.class); boolean value = (boolean) expression.getValue(context); if (!value) { collector.fatal(this, "Policy statement \"" + policyStatement + "\" evaluated to false"); } } catch (Exception e) { collector.fatal(this, "Policy statement \"" + policyStatement + "\" evaluated to an exception " + e.getClass() .getName() + " with message: " + e.getMessage()); LOGGER.log(Level.FINEST, e, () -> "Statement " + policyStatement + " evaluation failed"); } }
public Class getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null && this.fn1 != null) { return this.fn1.resolveFunction(prefix, name); } return m; }
/** * {@inheritDoc} */ @Override public void setFunction(String prefix, Method method) { FunctionMapper functions = elContext.getFunctionMapper(); functions.mapFunction(prefix, method.getName(), method); }
public Class getType(EvaluationContext ctx) throws ELException { FunctionMapper fnMapper = ctx.getFunctionMapper(); // quickly validate again for this request if (fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } Method m = fnMapper.resolveFunction(this.prefix, this.localName); if (m == null) { throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName())); } return m.getReturnType(); }
/** * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) */ @Override public Method resolveFunction(String prefix, String name) { Method m = this.fn0.resolveFunction(prefix, name); if (m == null) { return this.fn1.resolveFunction(prefix, name); } return m; }
/** * {@inheritDoc} */ @Override public void setFunction(String prefix, String name, Method method) { FunctionMapper functions = elContext.getFunctionMapper(); functions.mapFunction(prefix, name, method); }