/// <summary> // Set the Permissions for the current role. // TODO: This should be handled by the IdentityServer /// </summary> private bool GetClientPermissions(Enums.ClientRole clientRole) { if (clientRole == Enums.ClientRole.Manager) { return(true); } return(false); }
public BasicAuthorizeAttribute(Enums.ClientRole role) { // TODO: This should be handled by the IdentityServer var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddEnvironmentVariables(); _configuration = builder.Build(); _currentRole = role; _managerToken = _configuration.GetSection("Tokens:Manager").Value; _regularClientToken = _configuration.GetSection("Tokens:RegularClient").Value; }
/// <summary> // Set the Token based on the current user role. // TODO: This should be handled by the IdentityServer, but for // purposes of this assesment will be handled like this. /// </summary> private string GetClientToken(Enums.ClientRole clientRole) { // Set the Token based on the current user role. // TODO: This should be handled by the IdentityServer, but for // purposes of this assesment will be handled like this. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddEnvironmentVariables(); Configuration = builder.Build(); if (clientRole == Enums.ClientRole.Manager) { return(Configuration.GetSection("Tokens:Manager").Value); } return(Configuration.GetSection("Tokens:RegularClient").Value); }