aws / aws-aspnet-cognito-identity-provider

ASP.NET Core Identity Provider for Amazon Cognito
https://aws.amazon.com/developer/language/net/
Apache License 2.0
215 stars 89 forks source link

Question: Setup CognitoRole? #127

Closed DragonMastery closed 5 years ago

DragonMastery commented 5 years ago

How exactly do I set my project up so that CognitoRole works? Specifically the ApplicationDbContext....

klaytaybai commented 5 years ago

Hi @DragonMastery, could you please review this documentation and let us know if you need further guidance around this?

DragonMastery commented 5 years ago

Well, to be honest the documentation does not help very much with explaining how the Role Service works. So I read through the source code and now I get it. You are using Cognito Groups as Roles. It would be nice if that were a little more clarified somewhere, because I really did not get that until I read through the source code. It might help if it were expanded on in HERE In essence the Roles have nothing to do with the ApplicationDbContext because the are not stored in the database.

assyadh commented 5 years ago

Any reason why you are mentioning ApplicationDbContext? We don't use it anymore in this library.

Here is how we use Roles in this library:

https://github.com/aws/aws-aspnet-cognito-identity-provider/blob/master/docs/7-User%20Roles.md

Roles are just mapped to a group you create in cognito.

DragonMastery commented 5 years ago

Thats literally what I just wrote.... with the same link... and to answer your question, your sample has it: https://github.com/aws/aws-aspnet-cognito-identity-provider/blob/master/samples/Samples/Data/ApplicationDbContext.cs

assyadh commented 5 years ago

Yes, the sample has the old EF code, but it is swapped with the Cognito access layer.

Thanks for the feedback, made it more clear on the docs.

I will close this, let me now if you still have questions.