Role Based Access Authorization in perfect

185 Views Asked by At

Being new to perfect server side swift, I cannot find any packages that help with role based access authorization. In Spring there is for example,

.antMatchers("/homePage").access("hasRole('ROLE_USER') or hasRole('ROLE_ADMIN')")
.antMatchers("/adminPage").access("hasRole('ROLE_ADMIN')")

Is there something already existing in perfect to help with this? Is there a recommended way of handling access control in perfect?

2

There are 2 best solutions below

1
On

Perfect provides system level of authentication.

Firstly, you can go to github and search PerfectlySoft/Perfect-LocalAuthentication for user identity validation, however, it doesn't contain the role control as you asked.

It can be done in other approaches. For example, you can use Perfect-LDAP to access an LDAP server for all kinds of roles and groups.

1
On