Skip to content
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

Support simple authorize with policy #32

Open
thangchung opened this issue Dec 18, 2018 · 0 comments
Open

Support simple authorize with policy #32

thangchung opened this issue Dec 18, 2018 · 0 comments
Assignees

Comments

@thangchung
Copy link
Member

Just like https://github.com/EduardoPires/EquinoxProject/blob/master/src/Equinox.WebApi/Startup.cs#L61, but we will put it into the configuration (consider using feature toggle), then just do something like

appsettings.json

"Features": {
	"Authz": {
		"CanWriteCustomerData": {
			"Customers": "Write"
		},
		"CanRemoveCustomerData": {
			"Customers": "Remove"
		}
	}	
}

Then in the CustomerController.cs

[Authorize]
public class CustomerController : ApiController
{
	[HttpPost]
    [Authorize(Policy = "CanWriteCustomerData")]
    [Route("customer-management")]
    public IActionResult Post([FromBody]CustomerViewModel customerViewModel)
    {
		
	}
}
@thangchung thangchung self-assigned this Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant