pac4j

Replacement for deprecated getPermission method in UserProfile Pac4J


We are using PAC4J version 5.7.1 in Java and recently I have noticed the getPermissions() method in UserProfile class is tagged as deprecated. We are still using this component and did not find any replacement for it in the documentation. The function is still working but using deprecated method is not the best practice here.

Is there any other way or alternative to replace this deprecated method?


Solution

  • Indeed, pac4j aims to be an easy security framework so the permissions have been removed in v6 (and deprecated in v5) as they work exactly like the roles.

    The idea is to only use the roles.

    For the integration with Shiro which explicitly has permissions, you may use the $shiro_permissions$ attribute for permissions: https://github.com/bujiio/buji-pac4j/blob/master/src/main/java/io/buji/pac4j/realm/Pac4jRealm.java#L107