Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[soteria-dev] Programmatically change roles

Hi soteria-dev-group,

I implemented a normal and default authentication process with the new java EE 8 security API and it worked perfectly.

But now I get stuck at the moment with the problem to change the users-roles upon selecting a new 'organization-unit' on the website. I have a JSF-application, and a user belongs to one or more organization units. Depending on these units, he has different 'roles' or groups. These organization-units are available on a select-box on the web-page, and if I change this value, the new roles should be applied.

The problem now is, that when I am calling the following:
    public void onChangeOrganizationUnit(final AjaxBehaviorEvent event) {  // <--- this method is called when selecting a new value from the select-box on the HTL-page

        AuthenticationStatus status = this.securityContext.authenticate(
                (HttpServletRequest) externalContext.getRequest(),
                (HttpServletResponse) externalContext.getResponse(),
                AuthenticationParameters.withParams()
                        .newAuthentication(true)
                        .credential(credential)
        );
    }

This status is always "SUCCESS". It never calls the "validate"-Method of the IdentityStore. I think, that has something to do, that this request is an AJAX-request and there is some "caching", which recognizes no changes in the current HTTP-Request. Is this asumption correct?

Can you give me some hints, where to look or how to implement such use-case?

Thanks in advance for any advice
Ulrich



Back to the top