Posts

Showing posts from November, 2018

OAuth vs JWT

The question is an common one, but it isn't quite sensible. JWT is a type of Token, and OAuth is a Framework that describes how to dispense tokens. JWT can absolutely be used as an OAuth Bearer token. In fact, this is the most common practice. In light of that "JWT vs OAuth" is a comparison of apples and apple carts. Often people think "OAuth token"  always  implies an opaque token that is granted by a OAuth token dispensary, that can then be validated only by that same OAuth dispensary system. But this is not the only kind of OAuth token. JWT is just a different kind of OAuth token. Today, the OAuthV2/GenerateAccessToken policy in Apigee Edge generates opaque tokens. It returns a token of 32 seemingly random characters, and the holder has no idea what the token signifies. Therefore, we call it "opaque". To USE the token, the holder must present it back to the token dispensary, because the original dispensary is the only party that can relate the

@EnableResourceServer Vs (@EnableOAuth2Sso and @EnableOAuth2Client)

OAuth defines four roles: resource owner An entity capable of granting access to a protected resource. When the resource owner is a person, it is referred to as an end-user. resource server The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens. client An application making protected resource requests on behalf of the resource owner and with its authorization. The term "client" does not imply any particular implementation characteristics (e.g., whether the application executes on a server, a desktop, or other devices). authorization server The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization. @EnableResourceServer  annotation means that your service (in terms of OAuth 2.0 - Resource Server) expects an access token in order to process

H2-Console is not showing in browser

Image
If you have override configure method of Spring Security and you want to use console of h2 database in browser, and after connect h2-console showing loading error as shown in below image. Then you have to add following line in your overridden configure method. @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter {    Logger logger = LoggerFactory.getLogger(SecurityConfig. class );       //......            @Override    protected void configure(HttpSecurity http) throws Exception {      http.authorizeRequests().antMatchers( "/" ).permitAll();      http.authorizeRequests().antMatchers( "/imgs/**" ).permitAll();      http.authorizeRequests().antMatchers( "/admin/**" ).hasRole( "ADMIN" );      http.authorizeRequests().antMatchers( "/**" ).hasRole( "USER" ).and().formLogin();           // add this line to use H2 web console     http.headers().frameOptions

Store Management in React / Angular such as Redux / NgRx

Store Management   A Store (state) management library (such as Redux, Angular-Redux, NgRx etc.) gives you a convenient way to Model your application state, derive computed values from it, Monitor it for changes. Store management solves the extraneous props / inputs issue in components hierarchy. If we try to solve those scenarios with event emitters like Angular @Input() / @Output(), we will easily end up with event soup scenarios, where the events chain themselves in unexpected ways, and it becomes hard to reason about the application. It solves the problem of component interaction via the Observable pattern It provides a client-side cache if needed, to avoid doing repeated Ajax requests It provides a place to put temporary UI state, as we fill in a large form or want to store search criteria in a search form when navigating between router views It solves the problem of allowing modification of client side transient data by multiple actors             Characteristics of S

Why Angular? Why Not React?

Image
A very common question. Let's search its answer. Instead of following market trends, always choose the best technology stack based on your project requirements and business needs. Lets discuss, why Angular and why not react. Why Angular? If you are already familiar with OOPs or you have C# / Java background and know dependency injection then the learning curve is comparatively low. If your application has not a dynamic UI i.e. forms are predefined and could not change at runtime. Angular is a full-fledge framework to create enterprise business applications. 70% same code for Mobile App i.e. Only Html & CSS files would be separated for Web and Mobile apps and some specific modules (Using NativeScript) Good separation between logic, markup, styles. NgModule, Modularize approach which organize the architecture of app in a better way. HttpClient Angular Module. Supports custom headers, request type, automatically parses JSON, can be streamed, piped, debounc

Bootstrap 4 - A Quick Review

Bootstrap 4 ·          Bootrap is now officially sass-first project. ·          FlexBox for responsiveness, Traditionally Bootstrap’s layout has been powered by float-based styles ·          Besides Bootstrap’s move away from float-based layouts, its responsiveness now also comes with an extra tier. From now on, you’ll be able to customise these five defaults: $grid-breakpoints: ( xs: 0px, sm: 576px, md: 768px, lg: 992px, xl: 1200px /*New Tier Added*/ ) !default; ·          The default web fonts (Helvetica Neue, Helvetica, and Arial) have been dropped in Bootstrap 4 and replaced with a “native font stack” for optimum text rendering on every device and OS $font-family-sans-serif :   // Safari for OS X and iOS (San Francisco)   -apple-system ,   // Chrome < 56 for OS X (San Francisco)   BlinkMacSystemFont ,   // Windows   "Segoe UI" ,   // Android   "Roboto" ,   // Basic web fallback