Merge pull request #8364 from catalin-burcea/BAEL-9552

[BAEL-9552] - Create spring-security-modules folder
This commit is contained in:
Josh Cummings 2019-12-16 10:55:28 -07:00 committed by GitHub
commit 1e8cec553a
712 changed files with 1140 additions and 1141 deletions

87
pom.xml
View File

@ -630,7 +630,7 @@
<module>spring-boot-performance</module> <module>spring-boot-performance</module>
<module>spring-boot-properties</module> <module>spring-boot-properties</module>
<!-- <module>spring-mvc-basics</module> --> <!-- Compilation failure --> <!-- <module>spring-mvc-basics</module> --> <!-- Compilation failure -->
<module>spring-security-kerberos</module> <module>spring-security-modules/spring-security-kerberos</module>
<module>oauth2-framework-impl</module> <module>oauth2-framework-impl</module>
<module>spring-boot-nashorn</module> <module>spring-boot-nashorn</module>
@ -817,29 +817,28 @@
<module>spring-resttemplate</module> <module>spring-resttemplate</module>
<module>spring-roo</module> <module>spring-roo</module>
<module>spring-scheduling</module> <module>spring-scheduling</module>
<module>spring-security-acl</module> <module>spring-security-modules/spring-security-acl</module>
<module>spring-security-angular/server</module> <module>spring-security-modules/spring-security-angular/server</module>
<module>spring-security-cache-control</module> <module>spring-security-modules/spring-security-cache-control</module>
<module>spring-security-modules/spring-security-core</module>
<module>spring-security-core</module> <module>spring-security-modules/spring-security-mvc</module>
<module>spring-security-mvc-boot</module> <module>spring-security-modules/spring-security-mvc-boot</module>
<module>spring-security-mvc-custom</module> <module>spring-security-modules/spring-security-mvc-custom</module>
<module>spring-security-mvc-digest-auth</module> <module>spring-security-modules/spring-security-mvc-digest-auth</module>
<module>spring-security-mvc-jsonview</module> <module>spring-security-modules/spring-security-mvc-jsonview</module>
<module>spring-security-mvc-ldap</module> <module>spring-security-modules/spring-security-mvc-ldap</module>
<module>spring-security-mvc-login</module> <module>spring-security-modules/spring-security-mvc-login</module>
<module>spring-security-mvc-persisted-remember-me</module> <module>spring-security-modules/spring-security-mvc-persisted-remember-me</module>
<module>spring-security-mvc</module> <module>spring-security-modules/spring-security-mvc-socket</module>
<module>spring-security-mvc-socket</module> <module>spring-security-modules/spring-security-openid</module>
<module>spring-security-openid</module>
<!--<module>spring-security-react</module> --> <!-- fails on Travis, fails intermittently on the new Jenkins (01.12.2018) BAEL-10834 --> <!--<module>spring-security-react</module> --> <!-- fails on Travis, fails intermittently on the new Jenkins (01.12.2018) BAEL-10834 -->
<module>spring-security-rest</module> <module>spring-security-modules/spring-security-rest</module>
<module>spring-security-rest-basic-auth</module> <module>spring-security-modules/spring-security-rest-basic-auth</module>
<module>spring-security-rest-custom</module> <module>spring-security-modules/spring-security-rest-custom</module>
<module>spring-security-sso</module> <module>spring-security-modules/spring-security-sso</module>
<module>spring-security-stormpath</module> <module>spring-security-modules/spring-security-stormpath</module>
<module>spring-security-thymeleaf</module> <module>spring-security-modules/spring-security-thymeleaf</module>
<module>spring-security-x509</module> <module>spring-security-modules/spring-security-x509</module>
<module>spring-session</module> <module>spring-session</module>
<module>spring-shell</module> <module>spring-shell</module>
<module>spring-sleuth</module> <module>spring-sleuth</module>
@ -881,7 +880,7 @@
<module>tensorflow-java</module> <module>tensorflow-java</module>
<module>spring-boot-flowable</module> <module>spring-boot-flowable</module>
<module>spring-security-kerberos</module> <module>spring-security-modules/spring-security-kerberos</module>
<module>spring-boot-nashorn</module> <module>spring-boot-nashorn</module>
<module>java-blockchain</module> <module>java-blockchain</module>
@ -1424,27 +1423,27 @@
<module>spring-roo</module> <module>spring-roo</module>
<module>spring-scheduling</module> <module>spring-scheduling</module>
<module>spring-security-acl</module> <module>spring-security-modules/spring-security-acl</module>
<module>spring-security-angular/server</module> <module>spring-security-modules/spring-security-angular/server</module>
<module>spring-security-cache-control</module> <module>spring-security-modules/spring-security-cache-control</module>
<module>spring-security-core</module> <module>spring-security-modules/spring-security-core</module>
<module>spring-security-mvc-boot</module> <module>spring-security-modules/spring-security-mvc</module>
<module>spring-security-mvc-custom</module> <module>spring-security-modules/spring-security-mvc-boot</module>
<module>spring-security-mvc-digest-auth</module> <module>spring-security-modules/spring-security-mvc-custom</module>
<module>spring-security-mvc-ldap</module> <module>spring-security-modules/spring-security-mvc-digest-auth</module>
<module>spring-security-mvc-login</module> <module>spring-security-modules/spring-security-mvc-ldap</module>
<module>spring-security-mvc-persisted-remember-me</module> <module>spring-security-modules/spring-security-mvc-login</module>
<module>spring-security-mvc</module> <module>spring-security-modules/spring-security-mvc-persisted-remember-me</module>
<module>spring-security-mvc-socket</module> <module>spring-security-modules/spring-security-mvc-socket</module>
<module>spring-security-openid</module> <module>spring-security-modules/spring-security-openid</module>
<!--<module>spring-security-react</module> --> <!-- fails on Travis, fails intermittently on the new Jenkins (01.12.2018) BAEL-10834 --> <!--<module>spring-security-react</module> --> <!-- fails on Travis, fails intermittently on the new Jenkins (01.12.2018) BAEL-10834 -->
<module>spring-security-rest</module> <module>spring-security-modules/spring-security-rest</module>
<module>spring-security-rest-basic-auth</module> <module>spring-security-modules/spring-security-rest-basic-auth</module>
<module>spring-security-rest-custom</module> <module>spring-security-modules/spring-security-rest-custom</module>
<module>spring-security-sso</module> <module>spring-security-modules/spring-security-sso</module>
<module>spring-security-stormpath</module> <module>spring-security-modules/spring-security-stormpath</module>
<module>spring-security-thymeleaf</module> <module>spring-security-modules/spring-security-thymeleaf</module>
<module>spring-security-x509</module> <module>spring-security-modules/spring-security-x509</module>
<module>spring-session</module> <module>spring-session</module>
<module>spring-shell</module> <module>spring-shell</module>
<module>spring-sleuth</module> <module>spring-sleuth</module>

View File

@ -12,7 +12,7 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-boot-1</artifactId> <artifactId>parent-boot-1</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-1</relativePath> <relativePath>../../parent-boot-1</relativePath>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -1,65 +1,65 @@
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": { "project": {
"name": "angular-crud" "name": "angular-crud"
}, },
"apps": [ "apps": [
{ {
"root": "src", "root": "src",
"outDir": "dist", "outDir": "dist",
"assets": [ "assets": [
"assets", "assets",
"favicon.ico" "favicon.ico"
], ],
"index": "index.html", "index": "index.html",
"main": "main.ts", "main": "main.ts",
"polyfills": "polyfills.ts", "polyfills": "polyfills.ts",
"test": "test.ts", "test": "test.ts",
"tsconfig": "tsconfig.app.json", "tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json", "testTsconfig": "tsconfig.spec.json",
"prefix": "app", "prefix": "app",
"styles": [ "styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css", "styles.css",
"../node_modules/font-awesome/css/font-awesome.min.css" "../node_modules/font-awesome/css/font-awesome.min.css"
], ],
"scripts": [ "scripts": [
"../node_modules/jquery/dist/jquery.js", "../node_modules/jquery/dist/jquery.js",
"../node_modules/bootstrap/dist/js/bootstrap.js" "../node_modules/bootstrap/dist/js/bootstrap.js"
], ],
"environmentSource": "environments/environment.ts", "environmentSource": "environments/environment.ts",
"environments": { "environments": {
"dev": "environments/environment.ts", "dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts" "prod": "environments/environment.prod.ts"
} }
} }
], ],
"e2e": { "e2e": {
"protractor": { "protractor": {
"config": "./protractor.conf.js" "config": "./protractor.conf.js"
} }
}, },
"lint": [ "lint": [
{ {
"project": "src/tsconfig.app.json", "project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**" "exclude": "**/node_modules/**"
}, },
{ {
"project": "src/tsconfig.spec.json", "project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**" "exclude": "**/node_modules/**"
}, },
{ {
"project": "e2e/tsconfig.e2e.json", "project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**" "exclude": "**/node_modules/**"
} }
], ],
"test": { "test": {
"karma": { "karma": {
"config": "./karma.conf.js" "config": "./karma.conf.js"
} }
}, },
"defaults": { "defaults": {
"styleExt": "css", "styleExt": "css",
"component": {} "component": {}
} }
} }

View File

@ -1,68 +1,68 @@
/** /**
* This file includes polyfills needed by Angular and is loaded before the app. * This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file. * You can add your own extra polyfills to this file.
* *
* This file is divided into 2 sections: * This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file. * file.
* *
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
* *
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/ */
/*************************************************************************************************** /***************************************************************************************************
* BROWSER POLYFILLS * BROWSER POLYFILLS
*/ */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol'; // import 'core-js/es6/symbol';
// import 'core-js/es6/object'; // import 'core-js/es6/object';
// import 'core-js/es6/function'; // import 'core-js/es6/function';
// import 'core-js/es6/parse-int'; // import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float'; // import 'core-js/es6/parse-float';
// import 'core-js/es6/number'; // import 'core-js/es6/number';
// import 'core-js/es6/math'; // import 'core-js/es6/math';
// import 'core-js/es6/string'; // import 'core-js/es6/string';
// import 'core-js/es6/date'; // import 'core-js/es6/date';
// import 'core-js/es6/array'; // import 'core-js/es6/array';
// import 'core-js/es6/regexp'; // import 'core-js/es6/regexp';
// import 'core-js/es6/map'; // import 'core-js/es6/map';
// import 'core-js/es6/weak-map'; // import 'core-js/es6/weak-map';
// import 'core-js/es6/set'; // import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; import 'core-js/es6/reflect';
import 'core-js/es7/reflect'; import 'core-js/es7/reflect';
/** /**
* Required to support Web Animations `@angular/animation`. * Required to support Web Animations `@angular/animation`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/ **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS
*/ */
/** /**
* Date, currency, decimal and percent pipes. * Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/ */
// import 'intl'; // Run `npm install --save intl`. // import 'intl'; // Run `npm install --save intl`.
/** /**
* Need to import at least one locale-data with intl. * Need to import at least one locale-data with intl.
*/ */
// import 'intl/locale-data/jsonp/en'; // import 'intl/locale-data/jsonp/en';

View File

@ -1,68 +1,68 @@
/** /**
* This file includes polyfills needed by Angular and is loaded before the app. * This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file. * You can add your own extra polyfills to this file.
* *
* This file is divided into 2 sections: * This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file. * file.
* *
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
* *
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/ */
/*************************************************************************************************** /***************************************************************************************************
* BROWSER POLYFILLS * BROWSER POLYFILLS
*/ */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol'; // import 'core-js/es6/symbol';
// import 'core-js/es6/object'; // import 'core-js/es6/object';
// import 'core-js/es6/function'; // import 'core-js/es6/function';
// import 'core-js/es6/parse-int'; // import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float'; // import 'core-js/es6/parse-float';
// import 'core-js/es6/number'; // import 'core-js/es6/number';
// import 'core-js/es6/math'; // import 'core-js/es6/math';
// import 'core-js/es6/string'; // import 'core-js/es6/string';
// import 'core-js/es6/date'; // import 'core-js/es6/date';
// import 'core-js/es6/array'; // import 'core-js/es6/array';
// import 'core-js/es6/regexp'; // import 'core-js/es6/regexp';
// import 'core-js/es6/map'; // import 'core-js/es6/map';
// import 'core-js/es6/weak-map'; // import 'core-js/es6/weak-map';
// import 'core-js/es6/set'; // import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; import 'core-js/es6/reflect';
import 'core-js/es7/reflect'; import 'core-js/es7/reflect';
/** /**
* Required to support Web Animations `@angular/animation`. * Required to support Web Animations `@angular/animation`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/ **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS
*/ */
/** /**
* Date, currency, decimal and percent pipes. * Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/ */
// import 'intl'; // Run `npm install --save intl`. // import 'intl'; // Run `npm install --save intl`.
/** /**
* Need to import at least one locale-data with intl. * Need to import at least one locale-data with intl.
*/ */
// import 'intl/locale-data/jsonp/en'; // import 'intl/locale-data/jsonp/en';

View File

@ -1,68 +1,68 @@
/** /**
* This file includes polyfills needed by Angular and is loaded before the app. * This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file. * You can add your own extra polyfills to this file.
* *
* This file is divided into 2 sections: * This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file. * file.
* *
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
* *
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/ */
/*************************************************************************************************** /***************************************************************************************************
* BROWSER POLYFILLS * BROWSER POLYFILLS
*/ */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol'; // import 'core-js/es6/symbol';
// import 'core-js/es6/object'; // import 'core-js/es6/object';
// import 'core-js/es6/function'; // import 'core-js/es6/function';
// import 'core-js/es6/parse-int'; // import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float'; // import 'core-js/es6/parse-float';
// import 'core-js/es6/number'; // import 'core-js/es6/number';
// import 'core-js/es6/math'; // import 'core-js/es6/math';
// import 'core-js/es6/string'; // import 'core-js/es6/string';
// import 'core-js/es6/date'; // import 'core-js/es6/date';
// import 'core-js/es6/array'; // import 'core-js/es6/array';
// import 'core-js/es6/regexp'; // import 'core-js/es6/regexp';
// import 'core-js/es6/map'; // import 'core-js/es6/map';
// import 'core-js/es6/weak-map'; // import 'core-js/es6/weak-map';
// import 'core-js/es6/set'; // import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; import 'core-js/es6/reflect';
import 'core-js/es7/reflect'; import 'core-js/es7/reflect';
/** /**
* Required to support Web Animations `@angular/animation`. * Required to support Web Animations `@angular/animation`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/ **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS
*/ */
/** /**
* Date, currency, decimal and percent pipes. * Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/ */
// import 'intl'; // Run `npm install --save intl`. // import 'intl'; // Run `npm install --save intl`.
/** /**
* Need to import at least one locale-data with intl. * Need to import at least one locale-data with intl.
*/ */
// import 'intl/locale-data/jsonp/en'; // import 'intl/locale-data/jsonp/en';

View File

@ -12,7 +12,7 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<relativePath>../../</relativePath> <relativePath>../../../</relativePath>
</parent> </parent>
<dependencyManagement> <dependencyManagement>

View File

@ -1,29 +1,29 @@
package com.baeldung.springbootsecurityrest.controller; package com.baeldung.springbootsecurityrest.controller;
import java.security.Principal; import java.security.Principal;
import java.util.Base64; import java.util.Base64;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baeldung.springbootsecurityrest.vo.User; import com.baeldung.springbootsecurityrest.vo.User;
@RestController @RestController
@CrossOrigin @CrossOrigin
public class UserController { public class UserController {
@RequestMapping("/login") @RequestMapping("/login")
public boolean login(@RequestBody User user) { public boolean login(@RequestBody User user) {
return user.getUserName().equals("user") && user.getPassword().equals("password"); return user.getUserName().equals("user") && user.getPassword().equals("password");
} }
@RequestMapping("/user") @RequestMapping("/user")
public Principal user(HttpServletRequest request) { public Principal user(HttpServletRequest request) {
String authToken = request.getHeader("Authorization").substring("Basic".length()).trim(); String authToken = request.getHeader("Authorization").substring("Basic".length()).trim();
return () -> new String(Base64.getDecoder().decode(authToken)).split(":")[0]; return () -> new String(Base64.getDecoder().decode(authToken)).split(":")[0];
} }
} }

View File

@ -1,21 +1,21 @@
package com.baeldung.springbootsecurityrest.vo; package com.baeldung.springbootsecurityrest.vo;
public class User { public class User {
private String userName; private String userName;
private String password; private String password;
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
public void setUserName(String userName) { public void setUserName(String userName) {
this.userName = userName; this.userName = userName;
} }
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
} }

View File

@ -10,7 +10,7 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-boot-1</artifactId> <artifactId>parent-boot-1</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-1</relativePath> <relativePath>../../parent-boot-1</relativePath>
</parent> </parent>
<dependencies> <dependencies>

Some files were not shown because too many files have changed in this diff Show More