Skip to content

Java-2021/DevChandra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEVCHANDRA

Spring Boot Security OAuth2 Google

Followed by Microservice based design pattern using OAuth 2.0 and OpenID Connect to authenticate in the Google and get information to user.

Written by

Chandra

Technology stack:

  • Maven;
  • Spring Boot;
  • Spring Web;
  • Spring Security;
  • OAuth2 client;
  • HTML, CSS.

1. For registration your app in Google App, perform the following steps:

  • Go to https://console.developers.google.com and login with your Google account (this will be the developer account and the email of this account will be published when someone tries to authenticate with the Google application).
  • If you don't have a project create a new one and then click into the project.
  • In the menu "API manager" on the left side select "Credentials" --> "Create credentials" --> "OAuth client ID".

alt tag

alt tag

  • Copy the client ID and client Secret and update the application.yml

alt tag

security configuration

@Configuration public class securityconfig extends WebSecurityConfigurerAdapter{

protected void configure(HttpSecurity httpSecurity) throws Exception{
	httpSecurity.authorizeRequests()
	.anyRequest().authenticated()
	.and().oauth2Login();

2. To run this application use:

mvn spring-boot:run

3. Use below url for Test your project

http://localhost:1001

If you get user credetial then you used

http://localhost:1001/user

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published