-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use roles with custom authentication provider #481
Comments
Currently we do not support this but we are doing some work currently to improve our roles story. We can definitely consider doing something like this. |
That would be great. I understand this is a rather new technology and I really like the idea of SWAs. They would be a great fit for a lot of our applications. but things like this or the ability to link function app slots to environments are essential to be able to use them productively. |
Just stumbled across this thread and would like to reiterate the point @Skleni brought up. I would really like to implement this in my application so we can fully utilize Auth0 (or just use another provider to get around the 25 users on custom roles limit), but it doesn't seem to be supported yet. |
Hi thanks for this article. I am sending a custom claims in the openid auth app from Okta. I can access those claims when using Okta SDKs and typical ExpressJS apps, but how can I access them in SWA? |
We'll be releasing a feature shortly that will give you the opportunity to access the claims provided by the identity provider and map them to custom roles in Static Web Apps. @adrwh @AverageCakeSlice @Skleni Can you describe in more detail what you'd like to do with the claims? |
Hi @anthonychu I want to use them for simple authorization and role based access. In my users Okta app profile i will set a custom key/value, string attribute, eg "Role = Admin", and add that to the claim. Then in my existing express based app, i can authenticate the user using the Okta SDKs and retrieve that custom attribute from the access token, then use it in access to routes. I can obviously use the Okta SDKs in my Azure Static app to achieve the same result, however I would love to simply use the built-in Custom Open Id authentication, and retrieve the attribute, and have it attached to the user context, so that i can use it in my app. |
@adrwh Looks like the feature we're working on should work for you. We'll update this thread when it's ready, hopefully in a couple of weeks. |
@anthonychu pretty much exactly what @adrwh said. It sounds like you guys are already working on it though. Right now I have a really convoluted role-checking service. I'd ideally like to be able to use the custom roles to prevent function execution using something like |
@anthonychu We have a similar situation as well. We're using Auth0 for the user management and we'd like to manage the roles there as well. At the moment the role assignments are stored in our database and we have to look up the current user's roles on every function execution. This could be avoided if we were able to add them to the claims. |
Here's the newly released feature that allows you to programmatically assign roles. I think it should unblock the scenarios in this thread. See the documentation for more details. There's also a tutorial with a sample app. |
Thank you @anthonychu, read the docs, looks like it will work, i'll try this soon. |
Hi @anthonychu i have set this up now, but i am guessing we won't be able to debug the GetRoles function using the local auth emulator? |
Not yet. We’re still thinking about the best way to do this. For now you can do 2 things:
|
Hi @anthonychu and @mkarmark, thanks a lot for the docs and tutorial. Here's my config:
|
Is it possible to access a user's roles when using a custom authentication provider like Auth0? I would have expected that I can configure the provider so that the tokens contain the roles, but I couldn't find any documentation on it. After reading #429 I'm not sure anymore, is this not supported?
I wouldn't even need the built-in SWA roles to work, but without a possibility access additional claims, I can't implement it myself either.
The text was updated successfully, but these errors were encountered: