'How to configure npm proxy for the company's Zscaler settings?
0
In my company I can't download the node modules via npm, because the connection is being refused. We use a Zscaler with a .pac config file. I tried to configure the proxy via various tutorials
Is there a way to make npm install (the command) to work behind proxy?
https://www.jhipster.tech/configuring-a-corporate-proxy/
but I don't get it to work. When I type
npm --proxy http://username:[email protected]:80 install packagename
it tells me "event not found", when I type the password. If I leave the password field empty, I get
npm ERR! 418 I'm a teapot - GET http://registry.npmjs.org/electron - got unknown host (registry.npmjs.org:80)
Solution 1:[1]
Hi , Role-based authorization in ASP.NET Core , you can add role by yourself In JWT method and use these roles in action directly
In JWT method:
// Add roles as multiple claims
foreach(var role in user.Roles)
{
claims.Add(new Claim(ClaimTypes.Role, role.Name));
// these also work - and reduce token size
// claims.Add(new Claim("roles", role.Name));
// claims.Add(new Claim("role", role.Name));
}
Then you can add [Authorize(Roles= "xxx")] to action in controller:
[Authorize(Roles= "xxx")]
public async Task<ActionResult> CreateItem(
[FromRoute(Name = "storageID")] int storageId)
{
return Ok();
}
If you want to use Policy , you can add Role authorization in Policy.
Services.AddAuthorization(option =>
{
option.AddPolicy("PolicyName", x =>
{
//....any other attribute you want....
//Add Role authorization
x.RequireRole("Admin","xx",...);
});
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
