Skip to main content

Posts

Showing posts from July, 2021

IdentityServer4 Protecting Web API Using Client Credentials - Implement IClientStore And IResourceStore

In this article, we will implement an IdentityServer4 to protect a Web API with client credentials. Client Credentials Flow: Client credential flow suitable internal communication between that application. In this flow application request the IdentityServer jwt access token to consume the protected API resources. Client Credential flow requires 'ClientId', 'ClientSecret' for authentication. Clients are applications that want to consume the protected API by the IdentiyServer. Each client should register with IdentiyServer. So IdentityServer stores client information like 'ClientId'(unique identifier), 'ClientSecrets', 'Scopes' etc. So clients using 'ClientId', 'ClientSecret', 'Scopes'(optional) can request the IdentityServer as a trust client to get the JWT token. Protected API's are registered under IdentityServer as 'ApiResoucers' with set of 'Scopes'. So any client to access the protected API, then cl

NgRx(Version 12) | An Angular State Management Using @ngrx/data

In this article, we are going to implement an Angular application state management using @ngrx/data. @ngrx/data: In a general angular application using NgRx Store, Effects, and Entity libraries made us to write a huge number of actions, reducers, effects, selectors, HTTP API calls per entity model. It leads to a lot of repetitive code to create, maintain and test. Using NgRx Data we can reduce our code to very little despite having a large number of entity models in our application. The NgRx Data is an abstraction over the Store, Effects, and Entity that radically reduces the amount of code we have to write. By gaining the abstraction benefit, we are going to lose our direct interaction with NgRx libraries. Ngrx Store Flow: Using Ngrx we never contact the store directly, every store operation is carried out by the NgRx store implicitly. Our main point of contact is EntityCollectionService. Using EntityCollectionService for each entity can invoke API calls with default method like '

NgRx(Version 12) - An Angular Application State Management Using @ngrx/store

In this article, we will implement a sample Angular(Version 12) application state management using @ngrx/store(NgRx Version 12). NgRx Store For State Management: NgRx Store provides state management for creating maintainable, explicit applications through the use of a single state and actions in order to express state changes. The main building blocks for the NgRx store are: Actions Reducers Selectors NgRx Store State Management Flow: Angular components trigger the API call and fetch the response data. Angular component raises events through actions. Component passes the API response to the Actions. Reducers are logical functions that listen for action changes. Reducers update the store state based on actions and the payload carried by the actions. Selectors are consumed by angular components. Selectors serve the data from the store to angular components. Create An Angular Application: To start our demo let's create a sample angular application. Install Angular CLI: npm instal