Honzaja
Honzaja

Reputation: 13

Role-based Permissions

I'm currently trying to use Role-based permission on Micro-Integrator v 7.1.0 while calling api request, i've already managed to use REST Basic AuthHandler as shown below, which works just fine.

<handlers>
   <handler class="org.wso2.micro.integrator.security.handler.RESTBasicAuthHandler"/>
</handlers> 

Now i want to add role permission to it, but i can't seem to find a way on how to. I found some code that worked on older versions, but apparently not on 7.1

<handler class="org.wso2.api.authorization.RoleBasedAuthorizationHandler">
   <property name="roles" value="testRole"/>
</handler> 

Any suggestions on how to make this work? Thanks.

Upvotes: 1

Views: 163

Answers (1)

ycr
ycr

Reputation: 14604

I implemented a new authorization handler for MI. You can find it here. If you find any bugs please report them back to the Github project.

Once you add the Jar you can engage the Handler as shown below.

<handlers>
    <handler class="com.ycr.auth.handlers.AuthorizationHandler">
      <property name="roles" value="admin,test" />
      <property name="authorize" value="true" />
    </handler>
</handlers>

Upvotes: 1

Related Questions