[ 
https://issues.apache.org/jira/browse/KARAF-7954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950037#comment-17950037
 ] 

Matt Pavlovich commented on KARAF-7954:
---------------------------------------

Update: The isInstance check is suitable as it is today.

I added a unit test here to verify and catch any regressions.

https://github.com/apache/karaf/pull/1944

> Add unit test to KarafJaasAuthenticator for extended RolePrincipal
> ------------------------------------------------------------------
>
>                 Key: KARAF-7954
>                 URL: https://issues.apache.org/jira/browse/KARAF-7954
>             Project: Karaf
>          Issue Type: Improvement
>            Reporter: Matt Pavlovich
>            Priority: Minor
>
> Currently, the karaf ssh service needs to know exact RolePrincipal classes. 
> The ssh bundle will not be setup to _import_ any 3rd-party or custom 
> Principal classes, so using the class directly is not going to be 
> functionally useful
> Currently:
> {noformat}
> for (Class<?> roleClass : roleClasses) {
>     if (roleClass.isInstance(principal)) {
>         if (!hasCorrectRole) {
>             hasCorrectRole = role.equals(principal.getName());
>         }
>         roleCount++;
>     }
> }
> {noformat}
> Alternatively, it should check if roleClass.isAssignable and/or class name by 
> string match.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to