February 26, 2020
February 20, 2020
February 19, 2020
Ullu App launched the trailer of 'The Bull Of Dalal Street'
India’s one of the leading homegrown OTT platform Ullu App has charmed viewers with its diverse content. Their web-series Panchali, Singardaan, Halala and #MeToo Wolf Of Bollywood have already worked their wonders on the hearts of the audiences. Talking forward the excitement Ullu App is coming up yet another interesting web-series titled 'The Bull Of Dalal Street'. The trailer of this much awaited series was recently launched in Mumbai, and the event was graced by Iqbal Khan, Ashmit Patel, Kunal Verma, Megha Gupta, Naina Chhabra, Vibhu Agarwal and the show's director Deepak Pandey.
February 13, 2020
February 08, 2020
Difference between Spring's @RequestParam vs @PathVariable
What is the difference between Spring's @RequestParam vs @PathVariable Annotations.
Let's first understand the purpose and usage of @RequestParam and @PathVariable.
@RequestParam annotation is used to get the request parameters from URI, also known as query parameters. e.g If we have an incoming request with order id – http://scrutinybykhimaanshu.com/posts?postId=72
Then we can read the get the postId, using @RequestParam like below
@RequestMapping("/posts")
public String getPostDetails(@RequestParam("postId") String postId) {
return "postDetails";
}
The required=false can be used to make the query parameter optional. e.g
@RequestMapping("/posts")
public String getPostDetails(@RequestParam(value="postId", required=false) String postId) {
return "postDetails";
}
February 07, 2020
How to use YAML with Spring Boot?
What is YAML?
YAML stands for 'YAML Ain’t Markup Language'.
It is a human friendly data serialization standard for all programming languages. It is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data.
YAML is more readable and it is good for the developers for read/write configuration files.
YAML stands for 'YAML Ain’t Markup Language'.
It is a human friendly data serialization standard for all programming languages. It is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data.
YAML is more readable and it is good for the developers for read/write configuration files.
February 06, 2020
February 03, 2020
Spring Security-Part 4.3: Form Based Authentication
Form Based Authentication
- When we do basic authentication, we need to pass 'Authorization' in header (e.g, Authentication:Basic BASE_64_UserName:Password). Though the basic auth is simple and fast, it has one disadvantage that we can't logout.
- We can user form based authentication, in which user will enter user name and password and can logout whenever required.
To switch from Basic to Form based authentication, we need to update ApplicationSecurityConfig. In the configure() method instead of httpBasic(), we need to use formLogin().
Spring Security-Part 4.2: @PreAuthorize, @PostAuthorize, @Secured, @RoleAllowed, @EnableGlobalMethodSecurity annotations
Annotation Based Roles and Authorities/Permissions
In our previous tutorial we had configured the roles and authorities in ApplicationSecurityConfig (which extends WebSecurityConfigurerAdapter). We can do the same thing by using @PreAuthorize annotation.
Spring Security-Part 4.1: Spring Security
Let's create a new project from Spring Initializr https://start.spring.io/.
- Project: Maven Project
- Language: Java
- Spring Boot: 2.2.4
- Group: com.example
- Artifact: spring-security-demo
- Java Version: 8
- Dependencies: Spring Web
Spring Security-Part 3 : Spring Security with JPA authentication and MySQL
Example of Spring Security with JPA authentication and MySQL
We will build a Spring boot project with Spring Security that will do database authentication using JPA and connect with MYSQL database.
Let's say we have a mysql database locally with database instance with name 'springsecurity'. This database has a table with a name 'user'. 'roles' has comma separated roles.
We will build a Spring boot project with Spring Security that will do database authentication using JPA and connect with MYSQL database.
Let's say we have a mysql database locally with database instance with name 'springsecurity'. This database has a table with a name 'user'. 'roles' has comma separated roles.
#SpringSecurity Part 3 : Spring Security Flow
In the Part 1 of #SpringSecurity tutorial, we learned the difference between Authentication and Authorization. In Part 2, we created a Basic Authentication implementation was explained.
In this section, we will understand Spring Security Flow.
Above diagram show, how Spring Security works internally.
#SpringSecurity Part 2 : Securing Web-services with Spring (Basic, In-Memory and JDBC Authentication)
How can we implement basic authentication in Spring?
For this let us create a Spring Starter Project titled 'BasicAuthentication' from STS, this project has only Spring Web dependency.
For this let us create a Spring Starter Project titled 'BasicAuthentication' from STS, this project has only Spring Web dependency.
#SpringSecurity Part 2 : Creating a simple Spring security project (Basic Authentication)
In the Part 1 of #SpringSecurity tutorial, I explained the difference between Authentication and Authorization. Now let's see how can we implement basic authentication in Spring.
#SpringSecurity Part 1 : Authentication v/s Authorization
Authentication and Authorization are often used in conjunction with each other in terms of security, especially when it comes to gaining access to the system.
Authentication means confirming your own identity, while authorization means granting access to the system. We can say, authentication is the process of verifying who you are, while authorization is the process of verifying what you have access to.
Subscribe to:
Posts (Atom)