users@javaee-security-spec.java.net

[javaee-security-spec users] [jsr375-experts] Re: JDK 8 friendly APIs

From: Alex Kosowski <alex.kosowski_at_oracle.com>
Date: Sat, 24 Oct 2015 18:11:35 -0700

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