PingFederate OGNL expression to CustomDataSource - ognl

Is it possible to specify OGNL expression as input parameter for custom data store (CustomDataSourceDriver implementation)?
PingFederate 7.1.2

no but there's an (unsupported) custom OGNL datasource that can be used as an intermediary datasource to transform attributes in to a form that is useful for your own, consecutive datasource, see: https://code.google.com/p/pingfederate/source/browse/trunk/datasource/ognl/src/com/pingidentity/datasource/OGNLDataSource.java

You can use an OGNL expression on an attribute.
The OGNL expression has access to the HttpRequest. So – you can access all the headers from it.
Have more details in the below post :-
https://guptaashish.com/2016/04/22/pingfederate-include-complex-payload-in-a-saml-assertion/

Related

Grails Possible to use javascript with <g:if>?

Is it possible to use the state of a javascript global variable in the "test=" of a tag? If so how would I access that variable since ${} is usually to evaluate variable sent from the Controllers.
Try using a jQuery function in conjunction with JSON data returned from your controller. You may be able to accomplish what I think you need.

How do I access UrlMapping variables in grails from a filter?

I'm using Grails 2.1.5 and the Spring Security Core plugin.
I've overridden the WebSecurityExpressionRoot to add 2 signatures of a hasPermission method to the web expression paradigm.
This method delegates to classes by name in the applicationContext calling them with the request as an argument and an arbitrary string to provide further details if any are ever required.
In my delegate class I need to be able to access the parameters to assess whether or not the user may access the requested resource and this is fine but the request does not yet contain the variables defined from the UrlMappings.
I have tried acquiring the grailsUrlMappingsHolder from the applicationContext but when I call it's match method with a valid uri I get nothing.
I'm running out of time and may have to parse the request.getRequestURI() myself to try to infer the id if no request parameters are valid but this will not get urls mapped where the id is not last.
I really hate to re-invent the wheel here and I hate to miss out on using the UrlMappings to their fullest potential but the variables they define (in my circumstance) aren't available until I'm in the controller.
Take a look at what I do in AnnotationFilterInvocationDefinition - there's a bit of setup that you need to do: https://github.com/grails-plugins/grails-spring-security-core/blob/master/src/java/grails/plugin/springsecurity/web/access/intercept/AnnotationFilterInvocationDefinition.java

Is it possible to use immutable class in Struts2 form?

Situation: I am currently moving from using Struts 1 to Struts 2. In Struts 1, it was necessary for form classes to follow the JavaBean specification. Since my business data objects are all immutable, this required creating a JavaBean version of many classes, and methods mapping between the two.
Does Struts2 support using immutable objects for forms?
If so, how do I configure it such that the immutable object is instantiated from its builder using the form fields?
The object being populated from the request can't be immutable, because OGNL calls setters on it–that's just how OGNL (and most ELs) work.
I figure you have two options: you could either do something with a custom parameters interceptor, or create a constructor or builder that takes a bean used for the form.
Without any real thought, I'd probably do the latter, although I might create a quick tool to generate the form classes if there are a lot of them. An interceptor would be more elegant, but it'd probably need to use reflection.

OGNL exceptions setting Struts2 checkbox value

After adding a s:checkbox to my form, I get OGNL errors in the ParamsInterceptor:
WARN [OgnlValueStack] Error setting expression '__checkbox_filter.findRejected' with value '[Ljava.lang.String;#dc926f'
ognl.OgnlException: target is null for setProperty(null, "findRejected", [Ljava.lang.String;#dc926f)
I am aware that the extra hidden field with underscores in its name (__checkbox_filter.findRejected) was correctly added by Struts2.
I don't understand, however, why the ParametersInterceptor is trying to set this property, that was added by Struts2, on my Action (which obviously doesn't contain a '__checkbox_filter' property).
It is normal to see this OGNL error coming from with Struts2 checkboxes? How can I avoid it?
I've just stumble across the very same problem.
You need to place the Checkbox Interceptor BEFORE the Parameters Interceptor in your interceptor stack.
This is the case by default, so I guess that you're using a custom stack...
Most of the time the mistake in such cases is that we forget to write getters and setters for the attributes. So check whether the getters and setters are at their place.

Struts2 form to action fields mapping automatically

I would like to know if it is possible, in Struts2, to map an HTML form's fields to those of an action, automatically, without getters and setters.
It is clear that by getters and setters or the ParameterAware interface and the Map, fields can be set in the action, but I just wanted to know if otherwise there was a way.
First, instead of thinking in terms of "with fields with getters and setters" you are advised to think in terms of "bean properties" here. Struts2 (and most java frameworks) think in that way, they usually don't care (and rightly so) whether those "properties" are real fields or not.
The short answer to your question is: no.
But be aware that Struts2 is very flexible - when I say "no" I mean "using the default interceptors". You could always write your own interceptor instead of the default to do that - bad idea IMO.
The interceptor that does that mapping is (basically) the parameters interceptor. From its documentation:
This interceptor gets all parameters
from ActionContext#getParameters() and
sets them on the value stack by
calling ValueStack#setValue(String, Object)
typically resulting in the values
submitted in a form request being
applied to an action in the value
stack.
And looking into ValueStack.setValue(String,Object) we read:
Attempts to set a property on a
bean in the stack with the given
expression using the default search
order.
So there you have.
ModelDriven was the correct choice :)

Resources