jsr375-experts@javaee-security-spec.java.net

[jsr375-experts] Re: JDK 8 friendly APIs

From: Ivar Grimstad <ivar.grimstad_at_gmail.com>
Date: Wed, 28 Oct 2015 02:09:47 +0000

+1

On Sat, Oct 24, 2015 at 6:45 PM Alex Kosowski <alex.kosowski_at_oracle.com>
wrote:

> Great idea, addresses the "modernization" of the EE Security API!
>
> Another functional interface we have proposed is
>
> public interface AccessDecisionVoter {
>
> boolean checkPermission(InvocationContext context);
> }
>
> Perhaps we could add some methods on SecurityContext that take lambdas to
> evaluate an AccessDecisionVoter.
>
> For example:
>
> @Inject
> SecurityContext ctx;
>
> ctx.checkAccess(i -> schedule.isOfficeHrs())
>
>
> Just thought,
>
> Regards,
> Alex
>
>
> On 10/19/15 2:44 PM, arjan tijms wrote:
>
> Hi,
>
> Since Java EE 8 targets Java SE 8, maybe it's an idea to see if we can add
> some API patterns that are particularly friendly to JDK 8 style
> (functional) programming.
>
> E.g. adding some methods to CredentialValidationResult that take lambdas,
> you could do something like:
>
> cdi.select(IdentityStore.class).get()
> .validate(credential)
> .ifValid(e -> callbacks.cpc(e.getCallerName())
> .elseThrow();
>
> The above is just a quick example, but it may be worth looking into.
>
> Kind regards,
> Arjan Tijms
>
>
>