Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: JWTAuthenticationMechanism.java #81

Open
christiancandela opened this issue Jun 6, 2018 · 5 comments
Open

BUG: JWTAuthenticationMechanism.java #81

christiancandela opened this issue Jun 6, 2018 · 5 comments
Assignees

Comments

@christiancandela
Copy link

Hello,
In the next line you have a error

isRememberMeExpression = "self.isRememberMe(httpMessageContext)"

change to

isRememberMeExpression = "#{self.isRememberMe(httpMessageContext)}")

@OndroMih
Copy link
Contributor

OndroMih commented Jun 6, 2018

I think both versions work with Soteria, but the Javadoc says that the value is an Expression and not an Expression in #{...}, so the current solution is better.

Github has lots of examples for both: https://github.com/search?p=2&q=isRememberMeExpression&type=Code

@arjantijms, do you know which is correct?

@OndroMih
Copy link
Contributor

OndroMih commented Jun 6, 2018

This is the code:

@arjantijms
Copy link
Contributor

@OndrejM it has to be an expression delimited with the #{} or ${} syntax.

The confusion comes perhaps from the earlier EE Security revision (pre 1.0) where I didn't put in the check for that syntax yet. The reasoning was indeed that if the attribute could only hold an expression, why require the syntax.

But, as we implemented EL support across the spec, it became clear that it looked quite inconsistent if for one annotation that had String members already the syntax was required (to distinguish from a plain string) and for other attributes (those that are specifically for expressions) not.

So at long lost we made the decision to simply require the syntax everywhere for expressions. The added benefit is that some IDE editors have an easier time recognising them as well.

In the code you see this here:

  public static boolean evalELExpression(ELProcessor getELProcessor, String expression, boolean defaultValue) {
        if (!isELExpression(expression)) {
            return defaultValue;
        }
        
        return (Boolean) getELProcessor(getELProcessor).eval(toRawExpression(expression));
    }

If it's not an EL expression, the default value is taken, which in this case is the value of the boolean isRememberMe. I'll try to clarify this in the JavaDoc.

@christiancandela
Copy link
Author

christiancandela commented Jun 6, 2018 via email

@christiancandela
Copy link
Author

christiancandela commented Jun 6, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants