Policy authorization in ASP.NET Core First let’s create a WebAPI application. Then introduce the Microsoft.AspNetCore.Authentication.JwtBearer package. Strategy In the ConfigureServices method of the Startup class, the form of adding a policy is as follows: services.AddAuthorization(options => { options.AddPolicy(“AtLeast21”, policy => policy.Requirements.Add(new MinimumAgeRequirement(21))); }); Here we go step by step. services.AddAuthorization is used to add authorization […]
Tag: .net
Simulating the Task mechanism in .net: exploring the mysteries of asynchronous programming
Using Task in .net makes it easy to write asynchronous programs. In order to better understand Task and its scheduling mechanism, let’s simulate the implementation of Task in order to understand: What is Task How tasks are scheduled Basic Task simulation implementation Start with the most basic Task usage Task.Run(Action action) The function of this […]
ASP.NET Core Model Binding – Advanced
In this section, we use examples to explain the advanced concepts of model binding. We explain them from these dimensions: 1 Model binding array type 2 Model binding collection type 3 Model binding complex collection types 4 Model binding sources 1 Model binding array type Using model binding we can bind array type parameters to […]
java.security.AccessControlException: access denied (“java.net.SocketPermission“ “x.x.x.x:80“ “conn
When running the java applet, an error is reported. The console error message is as follows: java.security.AccessControlException: access denied (“java.net.SocketPermission” “x.x.x.x:80” “connect,resolve”) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_102] at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_102] at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_102] at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051) ~[?:1.8.0_102] at java.net.Socket.connect(Socket.java:584) ~[?:1.8.0_102] at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74) ~[?:?] at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) ~[?:?] at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) ~[?:?] at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) ~[?:?] at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[?:?] at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) ~[?:?] […]
.NET MAUI announced in .NET 8 Release Candidate 2: Higher quality
Click on the blue words Follow us Author: David Ortinau Typesetting: Rani Sun With the release of .NET MAUI in .NET 8 Release Candidate 2 (RC2), we are one step closer to .NET 8 General Availability (GA). Like RC1, this version includes a go-live license, so you’re supported when using it in production applications. In […]
Use of Identity framework in ASP.NET Core
Identity framework: 1. Adopt the Role-Based Access Control (RABC) strategy, which has built-in management of user, role and other tables and related interfaces. 2. The Identity framework uses EF Core to operate the database. Identity framework usage Since the Identity framework uses EF Core to operate the database, the operation has similar expenditures as defining […]
ASP.NET Core Filter Advanced
In this section we discuss advanced topics of filters – filter dependencies, global filters, filter execution order & changing the filter order. In the previous section we introduced the basic use of filters in ASP.NET Core 1 ASP.NET Core filter dependency injection If a filter has a dependency, it cannot be applied to the action […]
.Net8 CLR cross-generation (card_table) continued
1. Preface card_table is one of the core technologies of CLR. Its bit mark loops through the old generation heap (oldest_gen) to find out the reference of the old heap object to the new generation. Extracting it from CLR and GC is a relatively complex project. Taking .Net8 as the example Blueprint, this article simplifies […]
YARP: A highly customizable reverse proxy built with .NET
Reverse proxy is a common network technology that can achieve a variety of functions, such as load balancing, caching, compression, transcoding, etc. And plays an important role on the Internet, improving the performance, reliability, and security of websites. However, it is not easy to build a high-performance, reliable and customizable reverse proxy. The existing reverse […]
.NET and VUE use RSA encryption to complete login and issue JWT tokens to set permissions and access.
Backend generates public and private keys Use the RSA.ToXmlString(Boolean) method to generate public and private keys. RSACryptoServiceProvider rSA = new(); string pubKey = rSA.ToXmlString(false);//Public key string priKey = rSA.ToXmlString(true);//Private key The backend sends the generated public key to the frontend Create a get request and send the public key generated by the back-end to the […]