├── basic ├── src │ ├── assets │ │ └── .gitkeep │ ├── app │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.ts │ │ └── app.module.ts │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ ├── index.html │ │ └── java │ │ │ └── demo │ │ │ └── UiApplication.java │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── styles.css │ ├── typings.d.ts │ ├── tsconfig.app.json │ ├── index.html │ ├── tsconfig.spec.json │ ├── main.ts │ ├── test │ │ └── java │ │ │ └── demo │ │ │ └── ApplicationTests.java │ └── test.ts ├── ng ├── npm ├── e2e │ ├── app.po.ts │ ├── tsconfig.e2e.json │ └── app.e2e-spec.ts ├── .editorconfig ├── tsconfig.json ├── .vscode │ ├── tasks.json │ └── launch.json ├── protractor.conf.js └── karma.conf.js ├── proxy ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── home.component.html │ │ │ ├── app.component.html │ │ │ ├── home.component.ts │ │ │ ├── login.component.html │ │ │ ├── login.component.ts │ │ │ ├── app.component.ts │ │ │ ├── app.service.ts │ │ │ └── app.component.spec.ts │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.css │ │ ├── typings.d.ts │ │ ├── tsconfig.app.json │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── docker-compose.yml ├── resource │ └── src │ │ ├── main │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── demo │ │ └── ApplicationTests.java ├── .vscode │ ├── tasks.json │ └── launch.json └── pom.xml ├── single ├── src │ ├── assets │ │ └── .gitkeep │ ├── app │ │ ├── app.component.css │ │ ├── home.component.html │ │ ├── app.component.html │ │ ├── home.component.ts │ │ ├── login.component.html │ │ ├── login.component.ts │ │ ├── app.component.ts │ │ ├── app.service.ts │ │ └── app.component.spec.ts │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── styles.css │ ├── typings.d.ts │ ├── main │ │ └── resources │ │ │ └── application.yml │ ├── tsconfig.app.json │ ├── index.html │ ├── tsconfig.spec.json │ ├── main.ts │ └── test.ts ├── ng ├── npm ├── e2e │ ├── app.po.ts │ ├── tsconfig.e2e.json │ └── app.e2e-spec.ts ├── .editorconfig ├── .vscode │ ├── tasks.json │ └── launch.json ├── tsconfig.json ├── protractor.conf.js └── karma.conf.js ├── double ├── admin │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── read.component.html │ │ │ ├── changes.component.html │ │ │ ├── unauthenticated.component.html │ │ │ ├── write.component.html │ │ │ ├── unauthenticated.component.ts │ │ │ ├── read.component.ts │ │ │ ├── changes.component.ts │ │ │ ├── write.component.ts │ │ │ ├── app.component.html │ │ │ ├── app.service.ts │ │ │ ├── app.component.spec.ts │ │ │ └── app.component.ts │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.css │ │ ├── typings.d.ts │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.module.ts │ │ │ └── app.component.ts │ │ ├── styles.css │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── typings.d.ts │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── gateway │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.module.ts │ │ │ └── app.component.ts │ │ ├── styles.css │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── typings.d.ts │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ ├── test │ │ │ └── java │ │ │ │ └── demo │ │ │ │ └── ApplicationTests.java │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── docker-compose.yml ├── home.png ├── login.png ├── double-simple.odg ├── double-simple.png ├── double-components.odg ├── double-components.png ├── resource │ └── src │ │ ├── main │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── demo │ │ ├── ResourceTests.java │ │ └── ApplicationTests.java └── pom.xml ├── oauth2 ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.module.ts │ │ │ ├── app.component.html │ │ │ └── app.component.ts │ │ ├── styles.css │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── typings.d.ts │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ ├── test.ts │ │ └── main │ │ │ └── resources │ │ │ └── application.yml │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── authserver │ └── src │ │ └── main │ │ └── resources │ │ ├── keystore.jks │ │ ├── application.properties │ │ └── templates │ │ ├── login.ftl │ │ └── authorize.ftl ├── resource │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ └── java │ │ │ └── demo │ │ │ └── ResourceApplication.java │ │ └── test │ │ └── java │ │ └── demo │ │ └── ApplicationTests.java ├── pom.xml └── README.adoc ├── vanilla ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── home.component.html │ │ │ ├── app.component.html │ │ │ ├── home.component.ts │ │ │ ├── login.component.html │ │ │ ├── login.component.ts │ │ │ ├── app.component.ts │ │ │ ├── app.service.ts │ │ │ └── app.component.spec.ts │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.css │ │ ├── typings.d.ts │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── resource │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ └── java │ │ │ └── demo │ │ │ └── ResourceApplication.java │ │ └── test │ │ └── java │ │ └── demo │ │ └── ApplicationTests.java └── pom.xml ├── oauth2-logout ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.module.ts │ │ │ ├── app.component.html │ │ │ └── app.component.ts │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.css │ │ ├── typings.d.ts │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.yml │ │ │ └── java │ │ │ │ └── demo │ │ │ │ └── UiApplication.java │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── authserver │ └── src │ │ └── main │ │ └── resources │ │ ├── keystore.jks │ │ ├── application.properties │ │ └── templates │ │ └── login.ftl ├── .vscode │ ├── tasks.json │ └── launch.json ├── resource │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ └── java │ │ │ └── demo │ │ │ └── ResourceApplication.java │ │ └── test │ │ └── java │ │ └── demo │ │ └── ApplicationTests.java └── pom.xml ├── oauth2-vanilla ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.module.ts │ │ │ ├── app.component.html │ │ │ └── app.component.ts │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.css │ │ ├── typings.d.ts │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ └── test.ts │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── resource │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ └── java │ │ │ └── demo │ │ │ └── ResourceApplication.java │ │ └── test │ │ └── java │ │ └── demo │ │ └── ApplicationTests.java ├── authserver │ └── src │ │ └── main │ │ ├── resources │ │ ├── keystore.jks │ │ └── application.properties │ │ └── java │ │ └── demo │ │ └── AuthserverApplication.java ├── .vscode │ ├── tasks.json │ └── launch.json └── pom.xml ├── spring-session ├── ui │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── home.component.html │ │ │ ├── app.component.html │ │ │ ├── login.component.html │ │ │ ├── login.component.ts │ │ │ ├── home.component.ts │ │ │ ├── app.component.ts │ │ │ ├── app.service.ts │ │ │ └── app.component.spec.ts │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.css │ │ ├── typings.d.ts │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.yml │ │ ├── tsconfig.app.json │ │ ├── index.html │ │ ├── tsconfig.spec.json │ │ ├── main.ts │ │ └── test.ts │ ├── docker-compose.yml │ ├── ng │ ├── npm │ ├── e2e │ │ ├── app.po.ts │ │ ├── tsconfig.e2e.json │ │ └── app.e2e-spec.ts │ ├── .editorconfig │ ├── tsconfig.json │ ├── protractor.conf.js │ └── karma.conf.js ├── docker-compose.yml ├── resource │ └── src │ │ ├── main │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── demo │ │ └── ApplicationTests.java ├── .vscode │ ├── tasks.json │ └── launch.json ├── README.adoc └── pom.xml ├── .github └── dco.yml ├── .vscode └── settings.json ├── .mvn ├── jvm.config ├── maven.config └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── LICENSE.writing.txt ├── .travis.yml ├── CONTRIBUTING.adoc ├── Guardfile ├── .gitignore ├── README.adoc ├── LICENSE.code.txt └── pom.xml /basic/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /proxy/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /single/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /basic/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /double/admin/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /double/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /oauth2/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /single/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vanilla/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /double/admin/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /double/gateway/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /double/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /oauth2/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /proxy/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spring-session/ui/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /double/gateway/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | require: 2 | members: false 3 | -------------------------------------------------------------------------------- /vanilla/resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | -------------------------------------------------------------------------------- /basic/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | user: 3 | password: password -------------------------------------------------------------------------------- /double/docker-compose.yml: -------------------------------------------------------------------------------- 1 | redis: 2 | image: redis 3 | ports: 4 | - "6379:6379" 5 | -------------------------------------------------------------------------------- /proxy/docker-compose.yml: -------------------------------------------------------------------------------- 1 | redis: 2 | image: redis 3 | ports: 4 | - "6379:6379" 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "interactive" 3 | } -------------------------------------------------------------------------------- /spring-session/docker-compose.yml: -------------------------------------------------------------------------------- 1 | redis: 2 | image: redis 3 | ports: 4 | - "6379:6379" 5 | -------------------------------------------------------------------------------- /spring-session/ui/docker-compose.yml: -------------------------------------------------------------------------------- 1 | redis: 2 | image: redis 3 | ports: 4 | - "6379:6379" -------------------------------------------------------------------------------- /basic/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /basic/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /double/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /oauth2/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /proxy/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /proxy/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /single/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /single/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom -------------------------------------------------------------------------------- /double/admin/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /double/admin/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /double/gateway/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /double/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /oauth2/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /vanilla/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /vanilla/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /basic/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | ./node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /double/gateway/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /double/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/double/home.png -------------------------------------------------------------------------------- /double/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/double/login.png -------------------------------------------------------------------------------- /oauth2-logout/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /spring-session/ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /spring-session/ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local 2 | -------------------------------------------------------------------------------- /double/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | ./node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /oauth2/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | ./node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /proxy/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PWD:$PATH 4 | node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /single/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PWD:$PATH 4 | node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /vanilla/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PWD:$PATH 4 | node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /LICENSE.writing.txt: -------------------------------------------------------------------------------- 1 | Except where otherwise noted, this work is licensed under http://creativecommons.org/licenses/by-nd/3.0/ 2 | -------------------------------------------------------------------------------- /basic/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /double/admin/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PWD:$PATH 4 | node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /double/gateway/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | ./node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /oauth2-logout/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | ./node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | ./node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /proxy/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /single/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /double/admin/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /double/double-simple.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/double/double-simple.odg -------------------------------------------------------------------------------- /double/double-simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/double/double-simple.png -------------------------------------------------------------------------------- /double/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /oauth2/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /spring-session/ui/ng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PWD:$PATH 4 | node_modules/@angular/cli/bin/ng "$@" 5 | -------------------------------------------------------------------------------- /vanilla/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /double/gateway/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /oauth2-logout/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /spring-session/ui/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $(dirname $0) 3 | PATH="$PWD/node/":$PATH 4 | node "node/node_modules/npm/bin/npm-cli.js" "$@" 5 | -------------------------------------------------------------------------------- /double/double-components.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/double/double-components.odg -------------------------------------------------------------------------------- /double/double-components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/double/double-components.png -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip -------------------------------------------------------------------------------- /basic/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /single/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /double/admin/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /double/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /oauth2/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /proxy/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /vanilla/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /double/gateway/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /spring-session/ui/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /double/admin/src/app/read.component.html: -------------------------------------------------------------------------------- 1 |

Greeting

2 |
3 |

The ID is {{greeting.id}}

4 |

The content is {{greeting.content}}

5 |
6 | -------------------------------------------------------------------------------- /proxy/resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | server.address: 127.0.0.1 3 | security.sessions: NEVER 4 | spring.session.store-type: redis 5 | -------------------------------------------------------------------------------- /oauth2/authserver/src/main/resources/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/oauth2/authserver/src/main/resources/keystore.jks -------------------------------------------------------------------------------- /oauth2-vanilla/resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | server.address: 127.0.0.1 3 | security.oauth2.resource.userInfoUri: http://localhost:9999/uaa/user 4 | -------------------------------------------------------------------------------- /double/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | spring: 4 | session: 5 | store-type: redis 6 | logging: 7 | level: 8 | org.springframework.security: DEBUG 9 | -------------------------------------------------------------------------------- /oauth2-logout/authserver/src/main/resources/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/oauth2-logout/authserver/src/main/resources/keystore.jks -------------------------------------------------------------------------------- /oauth2-vanilla/authserver/src/main/resources/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/tut-spring-security-and-angular-js/HEAD/oauth2-vanilla/authserver/src/main/resources/keystore.jks -------------------------------------------------------------------------------- /oauth2/authserver/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9999 2 | server.contextPath: /uaa 3 | security.user.password: password 4 | logging.level.org.springframework.security: DEBUG -------------------------------------------------------------------------------- /spring-session/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | user: 3 | password: password 4 | ignored: 5 | - "*.bundle.*" 6 | spring: 7 | session: 8 | store-type: redis 9 | -------------------------------------------------------------------------------- /oauth2-logout/authserver/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9999 2 | server.contextPath: /uaa 3 | security.user.password: password 4 | logging.level.org.springframework.security: DEBUG -------------------------------------------------------------------------------- /single/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | user: 3 | password: password 4 | ignored: 5 | - "*.bundle.*" 6 | logging: 7 | level: 8 | org.springframework.security: DEBUG 9 | -------------------------------------------------------------------------------- /vanilla/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | user: 3 | password: password 4 | ignored: 5 | - "*.bundle.*" 6 | logging: 7 | level: 8 | org.springframework.security: DEBUG 9 | -------------------------------------------------------------------------------- /double/admin/src/app/changes.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. {{item.timestamp}} ({{item.user}}): "{{item.message}}"
  2. 3 |
4 |
No changes to show
5 | -------------------------------------------------------------------------------- /double/resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | server.address: 127.0.0.1 3 | security.sessions: NEVER 4 | spring.session.store-type: redis 5 | logging.level.org.springframework.security: debug -------------------------------------------------------------------------------- /double/admin/src/app/unauthenticated.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Login to see your greeting

3 |
4 |
5 |

Not permitted at this time. {{error}} Please login and try 6 | again.

7 |
8 | -------------------------------------------------------------------------------- /single/src/app/home.component.html: -------------------------------------------------------------------------------- 1 |

Greeting

2 |
3 |

The ID is {{greeting.id}}

4 |

The content is {{greeting.content}}

5 |
6 |
7 |

Login to see your greeting

8 |
9 | -------------------------------------------------------------------------------- /basic/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /proxy/ui/src/app/home.component.html: -------------------------------------------------------------------------------- 1 |

Greeting

2 |
3 |

The ID is {{greeting.id}}

4 |

The content is {{greeting.content}}

5 |
6 |
7 |

Login to see your greeting

8 |
9 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/home.component.html: -------------------------------------------------------------------------------- 1 |

Greeting

2 |
3 |

The ID is {{greeting.id}}

4 |

The content is {{greeting.content}}

5 |
6 |
7 |

Login to see your greeting

8 |
9 | -------------------------------------------------------------------------------- /double/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /oauth2/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /proxy/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /single/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /vanilla/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /double/admin/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /double/gateway/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spring-session/resource/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9000 3 | security: 4 | sessions: NEVER 5 | spring: 6 | session: 7 | store-type: redis 8 | logging: 9 | level: 10 | org.springframework: 11 | security: DEBUG 12 | session: TRACE -------------------------------------------------------------------------------- /spring-session/ui/src/app/home.component.html: -------------------------------------------------------------------------------- 1 |

Greeting

2 |
3 |

The ID is {{greeting.id}}

4 |

The content is {{greeting.content}}

5 |
6 |
7 |

Login to see your greeting

8 |
9 | -------------------------------------------------------------------------------- /oauth2-logout/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spring-session/ui/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /double/admin/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | level: 3 | org.springframework.security: DEBUG 4 | security: 5 | user: 6 | role: USER,ADMIN 7 | ignored: 8 | - "*.bundle.*" 9 | spring: 10 | session: 11 | store-type: redis 12 | server: 13 | port: 8082 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - openjdk8 4 | script: 5 | - mvn install 6 | notifications: 7 | slack: 8 | secure: PQfJGH7pGWjWURxh3yj2O6Ct1n0a7WGeZEqgJbm45+eWe0476OucPTS5BPvyUssuaLMXVRy87C3+WGhoGV9LHhljlC275MbTWp5khI7H/4jFXQ9CHPRKAB9/6i/2uqbBmQpPWHXLDDaOUB4NqrIhqUvf1SQF9g3TTVrHXKf2hv4= 9 | -------------------------------------------------------------------------------- /basic/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /double/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /oauth2/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /proxy/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /single/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /basic/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | Welcome {{title}}! 4 |

5 |
6 |

Id: {{greeting.id}}

7 |

Message: {{greeting.content}}

8 |
9 |
10 | 11 | -------------------------------------------------------------------------------- /double/admin/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /double/gateway/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /vanilla/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /spring-session/ui/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /basic/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /basic/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /proxy/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /single/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /double/admin/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /double/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /double/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oauth2/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /oauth2/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /proxy/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /proxy/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | user: 3 | password: password 4 | ignored: 5 | - "*.bundle.*" 6 | spring: 7 | session: 8 | store-type: redis 9 | zuul: 10 | routes: 11 | resource: 12 | path: /resource/** 13 | url: http://localhost:9000 14 | sensitive-headers: 15 | -------------------------------------------------------------------------------- /single/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /vanilla/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /vanilla/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /double/admin/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /double/gateway/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /double/gateway/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oauth2-logout/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /spring-session/ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /oauth2-logout/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spring-session/ui/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /single/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /basic/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome Demo!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /basic/src/main/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /double/admin/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Admin'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /double/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /oauth2/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /proxy/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /vanilla/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /basic/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /double/admin/src/app/write.component.html: -------------------------------------------------------------------------------- 1 |
2 |

The ID is {{greeting.id}}

3 |
4 | 6 |
7 | 8 |
9 | -------------------------------------------------------------------------------- /oauth2-logout/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /oauth2/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /proxy/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /single/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /double/admin/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /double/gateway/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome Demo!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /double/gateway/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /double/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /spring-session/ui/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Greeting'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /vanilla/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spring-session/ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.adoc: -------------------------------------------------------------------------------- 1 | All commits must include a __Signed-off-by__ trailer at the end of each commit message to indicate that the contributor agrees to the Developer Certificate of Origin. 2 | For additional details, please refer to the blog post https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring[Hello DCO, Goodbye CLA: Simplifying Contributions to Spring]. 3 | -------------------------------------------------------------------------------- /proxy/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /single/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /double/admin/src/app/unauthenticated.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | 4 | @Component({ 5 | templateUrl: './unauthenticated.component.html' 6 | }) 7 | export class UnauthenticatedComponent { 8 | 9 | error: string; 10 | 11 | constructor(private app: AppService) { 12 | this.error = app.error; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /double/admin/src/app/read.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | @Component({ 5 | templateUrl: './read.component.html' 6 | }) 7 | export class ReadComponent { 8 | 9 | greeting = {}; 10 | 11 | constructor(private http: HttpClient) { 12 | http.get('/resource').subscribe(data => this.greeting = data); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /basic/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /double/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /oauth2/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /proxy/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /single/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /vanilla/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /double/admin/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /double/gateway/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /basic/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /spring-session/ui/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /double/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /oauth2/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /proxy/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /single/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /vanilla/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /basic/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /double/admin/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /double/gateway/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /single/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "ng-build", 8 | "type": "shell", 9 | "command": "./ng build" 10 | }, 11 | { 12 | "label": "ng-watch", 13 | "type": "shell", 14 | "command": "./ng build --watch" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /single/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /double/admin/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /double/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /oauth2/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /proxy/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /spring-session/ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /vanilla/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /double/gateway/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /spring-session/ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /basic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /double/admin/src/app/changes.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | @Component({ 5 | templateUrl: './changes.component.html' 6 | }) 7 | export class ChangesComponent { 8 | 9 | data: any; 10 | 11 | constructor(private http: HttpClient) { 12 | this.http.get('/resource/changes').subscribe(response => { 13 | this.data = response; 14 | }); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /double/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /oauth2/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /proxy/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /single/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vanilla/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /double/admin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /double/gateway/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | require 'asciidoctor' 2 | require 'erb' 3 | 4 | options = {:mkdirs => true, :safe => :unsafe, :attributes => ['linkcss', 'allow-uri-read']} 5 | 6 | guard 'shell' do 7 | watch('README.adoc') {|m| 8 | Asciidoctor.render_file('README.adoc', options.merge(:to_dir => 'target/generated-docs')) 9 | } 10 | watch(/^[A-Z-a-z][^#]*\.adoc$/) {|m| 11 | Asciidoctor.render_file('README.adoc', options.merge(:to_dir => 'target/generated-docs')) 12 | } 13 | end 14 | -------------------------------------------------------------------------------- /basic/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "ng-build", 8 | "type": "shell", 9 | "command": "./ng build" 10 | }, 11 | { 12 | "label": "ng-watch", 13 | "type": "shell", 14 | "command": "./ng build --watch" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /oauth2-logout/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-session/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /basic/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'] 8 | }) 9 | export class AppComponent { 10 | title = 'Demo'; 11 | greeting = {}; 12 | constructor(private http: HttpClient) { 13 | http.get('resource').subscribe(data => this.greeting = data); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /proxy/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "ng-build", 8 | "type": "shell", 9 | "command": "./ui/ng build", 10 | }, 11 | { 12 | "label": "ng-watch", 13 | "type": "shell", 14 | "command": "./ui/ng build --watch" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /double/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 7 |

Greeting

8 |
9 |

The ID is {{greeting.id}}

10 |

The content is {{greeting.content}}

11 |
12 |
13 |

Login to see your greeting

14 |
15 | -------------------------------------------------------------------------------- /spring-session/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "ng-build", 8 | "type": "shell", 9 | "command": "./ui/ng build", 10 | }, 11 | { 12 | "label": "ng-watch", 13 | "type": "shell", 14 | "command": "./ui/ng build --watch" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /basic/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { HttpClientModule } from '@angular/common/http'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | HttpClientModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /double/ui/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { HttpClientModule } from '@angular/common/http'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | HttpClientModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /oauth2/ui/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { HttpClientModule } from '@angular/common/http'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | HttpClientModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { HttpClientModule } from '@angular/common/http'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | HttpClientModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { HttpClientModule } from '@angular/common/http'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | HttpClientModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /oauth2/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 |

Greeting

10 |
11 |

The ID is {{greeting.id}}

12 |

The content is {{greeting.content}}

13 |
14 |
15 |

Login to see your greeting

16 |
17 | -------------------------------------------------------------------------------- /oauth2-logout/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "ng-build", 8 | "type": "shell", 9 | "command": "./ui/ng build", 10 | }, 11 | { 12 | "label": "ng-watch", 13 | "type": "shell", 14 | "command": "./ui/ng build --watch" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /oauth2-vanilla/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "ng-build", 8 | "type": "shell", 9 | "command": "./ui/ng build", 10 | }, 11 | { 12 | "label": "ng-watch", 13 | "type": "shell", 14 | "command": "./ui/ng build --watch" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /oauth2-logout/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 |

Greeting

10 |
11 |

The ID is {{greeting.id}}

12 |

The content is {{greeting.content}}

13 |
14 |
15 |

Login to see your greeting

16 |
17 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 |

Greeting

10 |
11 |

The ID is {{greeting.id}}

12 |

The content is {{greeting.content}}

13 |
14 |
15 |

Login to see your greeting

16 |
17 | -------------------------------------------------------------------------------- /oauth2-vanilla/authserver/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9999 2 | server.contextPath: /uaa 3 | security.user.password: password 4 | security.sessions: if-required 5 | security.oauth2.client.clientId: acme 6 | security.oauth2.client.clientSecret: acmesecret 7 | security.oauth2.client.authorized-grant-types: authorization_code,refresh_token,password 8 | security.oauth2.client.scope: openid 9 | #security.oauth2.client.accessTokenValiditySeconds: 10 10 | logging.level.org.springframework.security: DEBUG 11 | -------------------------------------------------------------------------------- /spring-session/README.adoc: -------------------------------------------------------------------------------- 1 | This application uses http://projects.spring.io/spring-security[Spring Security] with http://angularjs.org[Angular JS] in a "single page application" where the UI and resource servers are separate, and secured using a shared token store implemented with https://github.com/spring-projects/spring-session/[Spring Session]. 2 | 3 | It is one of a pair of samples from an section and both are described in more detail https://github.com/spring-guides/tut-spring-security-and-angular-js/blob/master/vanilla/README.adoc[here]. 4 | -------------------------------------------------------------------------------- /double/gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | level: 3 | org.springframework.security: DEBUG 4 | security: 5 | sessions: ALWAYS 6 | ignored: 7 | - "*.bundle.*" 8 | - favicon.ico 9 | spring: 10 | session: 11 | store-type: redis 12 | zuul: 13 | routes: 14 | ui: 15 | url: http://localhost:8081 16 | sensitive-headers: 17 | admin: 18 | url: http://localhost:8082 19 | sensitive-headers: 20 | resource: 21 | url: http://localhost:9000 22 | sensitive-headers: 23 | -------------------------------------------------------------------------------- /proxy/ui/src/app/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | 5 | @Component({ 6 | templateUrl: './home.component.html' 7 | }) 8 | export class HomeComponent { 9 | 10 | title = 'Demo'; 11 | greeting = {}; 12 | 13 | constructor(private app: AppService, private http: HttpClient) { 14 | http.get('resource').subscribe(data => this.greeting = data); 15 | } 16 | 17 | authenticated() { return this.app.authenticated; } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /single/src/app/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | 5 | @Component({ 6 | templateUrl: './home.component.html' 7 | }) 8 | export class HomeComponent { 9 | 10 | title = 'Demo'; 11 | greeting = {}; 12 | 13 | constructor(private app: AppService, private http: HttpClient) { 14 | http.get('resource').subscribe(data => this.greeting = data); 15 | } 16 | 17 | authenticated() { return this.app.authenticated; } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /proxy/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-proxy 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Pairs Samples Proxy 10 | 11 | 12 | ui 13 | resource 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /vanilla/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-vanilla 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Pairs Samples Vanilla 10 | 11 | 12 | ui 13 | resource 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | 5 | @Component({ 6 | templateUrl: './home.component.html' 7 | }) 8 | export class HomeComponent { 9 | 10 | title = 'Demo'; 11 | greeting = {}; 12 | 13 | constructor(private app: AppService, private http: HttpClient) { 14 | http.get('http://localhost:9000').subscribe(data => this.greeting = data); 15 | } 16 | 17 | authenticated() { return this.app.authenticated; } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /double/admin/src/app/write.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | @Component({ 5 | templateUrl: './write.component.html' 6 | }) 7 | export class WriteComponent { 8 | 9 | greeting = {}; 10 | 11 | constructor(private http: HttpClient) { 12 | this.http.get('/resource').subscribe(data => this.greeting = data); 13 | } 14 | 15 | update() { 16 | this.http.post('/resource', {content: this.greeting['content']}).subscribe(response => { 17 | this.greeting = response; 18 | }); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /oauth2/resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | logging.level.org.springframework.security: DEBUG 3 | security.oauth2.resource.jwt.keyValue: -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGp/Q5lh0P8nPL21oMMrt2RrkT9AW5jgYwLfSUnJVc9G6uR3cXRRDCjHqWU5WYwivcF180A6CWp/ireQFFBNowgc5XaA0kPpzEtgsA5YsNX7iSnUibB004iBTfU9hZ2Rbsc8cWqynT0RyN4TP1RYVSeVKvMQk4GT1r7JCEC+TNu1ELmbNwMQyzKjsfBXyIOCFU/E94ktvsTZUHF4Oq44DBylCDsS1k7/sfZC2G5EU7Oz0mhG8+Uz6MSEQHtoIi6mc8u64Rwi3Z3tscuWG2ShtsUFuNSAFNkY7LkLn+/hxLCu2bNISMaESa8dG22CIMuIeRLVcAmEWEWH5EEforTg+QIDAQAB\n-----END PUBLIC KEY----- 4 | -------------------------------------------------------------------------------- /spring-session/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-spring-session 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Pairs Samples Spring Session 10 | 11 | 12 | ui 13 | resource 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /oauth2-logout/resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | logging.level.org.springframework.security: DEBUG 3 | security.oauth2.resource.jwt.keyValue: -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGp/Q5lh0P8nPL21oMMrt2RrkT9AW5jgYwLfSUnJVc9G6uR3cXRRDCjHqWU5WYwivcF180A6CWp/ireQFFBNowgc5XaA0kPpzEtgsA5YsNX7iSnUibB004iBTfU9hZ2Rbsc8cWqynT0RyN4TP1RYVSeVKvMQk4GT1r7JCEC+TNu1ELmbNwMQyzKjsfBXyIOCFU/E94ktvsTZUHF4Oq44DBylCDsS1k7/sfZC2G5EU7Oz0mhG8+Uz6MSEQHtoIi6mc8u64Rwi3Z3tscuWG2ShtsUFuNSAFNkY7LkLn+/hxLCu2bNISMaESa8dG22CIMuIeRLVcAmEWEWH5EEforTg+QIDAQAB\n-----END PUBLIC KEY----- 4 | -------------------------------------------------------------------------------- /oauth2/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-oauth2 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Pairs Samples OAuth2 10 | 11 | 12 | authserver 13 | ui 14 | resource 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Servers 2 | /.metadata 3 | /application.yml 4 | /application.properties 5 | *~ 6 | .#* 7 | *# 8 | target/ 9 | bin 10 | /data 11 | .classpath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache/ 16 | .attach_pid* 17 | .DS_Store 18 | *.sw* 19 | *.iml 20 | .idea 21 | nbproject/private/ 22 | build/ 23 | nbbuild/ 24 | dist/ 25 | nbdist/ 26 | .nb-gradle/# See http://help.github.com/ignore-files/ for more about ignoring files. 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | node/ 33 | node_modules/ 34 | e2e/*.js 35 | e2e/*.map 36 | -------------------------------------------------------------------------------- /oauth2-logout/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-oauth2-logout 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Pairs Samples OAuth2 10 | 11 | 12 | authserver 13 | ui 14 | resource 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /double/admin/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 13 |
14 |

Admin

15 | 16 |
17 | -------------------------------------------------------------------------------- /oauth2-vanilla/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-oauth2-vanilla 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Pairs Samples OAuth2 Vanilla 10 | 11 | 12 | authserver 13 | ui 14 | resource 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /double/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.demo 6 | pairs-double 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Security Angular Sample Double 10 | 11 | 12 | gateway 13 | ui 14 | resource 15 | admin 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /proxy/ui/src/app/login.component.html: -------------------------------------------------------------------------------- 1 |
2 | There was a problem logging in. Please try again. 3 |
4 |
5 |
6 | 8 |
9 |
10 | 12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /single/src/app/login.component.html: -------------------------------------------------------------------------------- 1 |
2 | There was a problem logging in. Please try again. 3 |
4 |
5 |
6 | 8 |
9 |
10 | 12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /proxy/ui/src/app/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Component({ 7 | templateUrl: './login.component.html' 8 | }) 9 | export class LoginComponent { 10 | 11 | credentials = {username: '', password: ''}; 12 | 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | } 15 | 16 | login() { 17 | this.app.authenticate(this.credentials, () => { 18 | this.router.navigateByUrl('/'); 19 | }); 20 | return false; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /single/src/app/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Component({ 7 | templateUrl: './login.component.html' 8 | }) 9 | export class LoginComponent { 10 | 11 | credentials = {username: '', password: ''}; 12 | 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | } 15 | 16 | login() { 17 | this.app.authenticate(this.credentials, () => { 18 | this.router.navigateByUrl('/'); 19 | }); 20 | return false; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/login.component.html: -------------------------------------------------------------------------------- 1 |
2 | There was a problem logging in. Please try again. 3 |
4 |
5 |
6 | 8 |
9 |
10 | 12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/login.component.html: -------------------------------------------------------------------------------- 1 |
2 | There was a problem logging in. Please try again. 3 |
4 |
5 |
6 | 8 |
9 |
10 | 12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Component({ 7 | templateUrl: './login.component.html' 8 | }) 9 | export class LoginComponent { 10 | 11 | credentials = {username: '', password: ''}; 12 | 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | } 15 | 16 | login() { 17 | this.app.authenticate(this.credentials, () => { 18 | this.router.navigateByUrl('/'); 19 | }); 20 | return false; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Component({ 7 | templateUrl: './login.component.html' 8 | }) 9 | export class LoginComponent { 10 | 11 | credentials = {username: '', password: ''}; 12 | 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | } 15 | 16 | login() { 17 | this.app.authenticate(this.credentials, () => { 18 | this.router.navigateByUrl('/'); 19 | }); 20 | return false; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /oauth2/README.adoc: -------------------------------------------------------------------------------- 1 | = Bootstrap UI and JWT Tokens for the Authorization Server 2 | 3 | You will find a version of this application in the https://github.com/dsyer/spring-security-angular/tree/master/oauth2-vanilla[source code in Github] which has a whitelabel HTML interface and HTTP Basic authentication. This one has a pretty login page and user approval page implemented similarly to the way we did the login page in https://github.com/dsyer/spring-security-angular/tree/master/single[the single server sample]. It also uses http://en.wikipedia.org/wiki/JWT[JWT] to encode the tokens, so instead of using the "/user" endpoint, the resource server can pull enough information out of the token itself to do a simple authentication. -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | tags: [security,angular,rest,oauth] 3 | projects: [spring-security,spring-security-oauth] 4 | --- 5 | :toc: left 6 | :icons: font 7 | :source-highlighter: prettify 8 | :image-width: 500 9 | 10 | = Spring Security and Angular 11 | 12 | include::basic/README.adoc[leveloffset=+1] 13 | include::single/README.adoc[leveloffset=+1] 14 | include::vanilla/README.adoc[leveloffset=+1] 15 | include::proxy/README.adoc[leveloffset=+1] 16 | include::oauth2-vanilla/README.adoc[leveloffset=+1] 17 | include::double/README.adoc[leveloffset=+1] 18 | include::testing.adoc[leveloffset=+1] 19 | include::oauth2-logout/README.adoc[leveloffset=+1] 20 | 21 | include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/footer.adoc[] 22 | -------------------------------------------------------------------------------- /double/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'] 8 | }) 9 | export class AppComponent { 10 | title = 'Demo'; 11 | greeting = {}; 12 | authenticated = false; 13 | user = ''; 14 | constructor(private http: HttpClient) { 15 | http.get('/user').subscribe(data => { 16 | if (data['name']) { 17 | this.authenticated = true; 18 | http.get('/resource').subscribe(response => this.greeting = response); 19 | } else { 20 | this.authenticated = false; 21 | } 22 | }, () => { this.authenticated = false; }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /basic/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "java", 9 | "name": "Debug (Launch)", 10 | "request": "launch", 11 | "cwd": "${workspaceFolder}", 12 | "mainClass": "demo.UiApplication", 13 | "projectName": "basic", 14 | "args": "" 15 | }, 16 | { 17 | "type": "java", 18 | "name": "Debug (Attach)", 19 | "request": "attach", 20 | "hostName": "localhost", 21 | "port": 0 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /single/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "java", 9 | "name": "Debug (Launch)", 10 | "request": "launch", 11 | "cwd": "${workspaceFolder}", 12 | "mainClass": "demo.UiApplication", 13 | "projectName": "basic", 14 | "args": "" 15 | }, 16 | { 17 | "type": "java", 18 | "name": "Debug (Attach)", 19 | "request": "attach", 20 | "hostName": "localhost", 21 | "port": 0 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE.code.txt: -------------------------------------------------------------------------------- 1 | All code in this repository is: 2 | ======================================================================= 3 | Copyright (c) 2013 GoPivotal, Inc. All Rights Reserved 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 4 | 5 | @Component({ 6 | templateUrl: './home.component.html' 7 | }) 8 | export class HomeComponent { 9 | 10 | title = 'Demo'; 11 | greeting = {}; 12 | 13 | constructor(private app: AppService, private http: HttpClient) { 14 | http.get('token').subscribe(data => { 15 | const token = data['token']; 16 | http.get('http://localhost:9000', {headers : new HttpHeaders().set('X-Auth-Token', token)}) 17 | .subscribe(response => this.greeting = response); 18 | }, () => {}); 19 | } 20 | 21 | authenticated() { return this.app.authenticated; } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /oauth2-logout/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome", 11 | "url": "http://localhost:8080", 12 | "webRoot": "${workspaceFolder}" 13 | }, 14 | { 15 | "type": "chrome", 16 | "request": "launch", 17 | "name": "Launch Chrome against localhost", 18 | "url": "http://localhost:8080", 19 | "webRoot": "${workspaceFolder}" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /oauth2-vanilla/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome", 11 | "url": "http://localhost:8080", 12 | "webRoot": "${workspaceFolder}" 13 | }, 14 | { 15 | "type": "chrome", 16 | "request": "launch", 17 | "name": "Launch Chrome against localhost", 18 | "url": "http://localhost:8080", 19 | "webRoot": "${workspaceFolder}" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /proxy/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | import 'rxjs/add/operator/finally'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.css'] 11 | }) 12 | export class AppComponent { 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | this.app.authenticate({}, undefined); 15 | } 16 | logout() { 17 | this.http.post('logout', {}).finally(() => { 18 | this.app.authenticated = false; 19 | this.router.navigateByUrl('/login'); 20 | }).subscribe(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /single/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | import 'rxjs/add/operator/finally'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.css'] 11 | }) 12 | export class AppComponent { 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | this.app.authenticate(undefined, undefined); 15 | } 16 | logout() { 17 | this.http.post('logout', {}).finally(() => { 18 | this.app.authenticated = false; 19 | this.router.navigateByUrl('/login'); 20 | }).subscribe(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | import 'rxjs/add/operator/finally'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.css'] 11 | }) 12 | export class AppComponent { 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | this.app.authenticate({}, undefined); 15 | } 16 | logout() { 17 | this.http.post('logout', {}).finally(() => { 18 | this.app.authenticated = false; 19 | this.router.navigateByUrl('/login'); 20 | }).subscribe(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | aop: 3 | proxy-target-class: true 4 | 5 | security: 6 | user: 7 | password: password 8 | ignored: 9 | - "*.bundle.*" 10 | oauth2: 11 | client: 12 | accessTokenUri: http://localhost:9999/uaa/oauth/token 13 | userAuthorizationUri: http://localhost:9999/uaa/oauth/authorize 14 | clientId: acme 15 | clientSecret: acmesecret 16 | resource: 17 | userInfoUri: http://localhost:9999/uaa/user 18 | 19 | zuul: 20 | routes: 21 | resource: 22 | path: /resource/** 23 | url: http://localhost:9000 24 | user: 25 | path: /user/** 26 | url: http://localhost:9999/uaa/user 27 | 28 | logging: 29 | level: 30 | org.springframework.security: DEBUG 31 | org.springframework.web: DEBUG 32 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | import 'rxjs/add/operator/finally'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.css'] 11 | }) 12 | export class AppComponent { 13 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 14 | this.app.authenticate({}, undefined); 15 | } 16 | logout() { 17 | this.http.post('logout', {}).finally(() => { 18 | this.app.authenticated = false; 19 | this.router.navigateByUrl('/login'); 20 | }).subscribe(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /basic/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /single/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /double/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /oauth2/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /proxy/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /vanilla/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /double/admin/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /double/gateway/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /oauth2-logout/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /spring-session/ui/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /proxy/ui/src/app/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | 4 | @Injectable() 5 | export class AppService { 6 | 7 | authenticated = false; 8 | 9 | constructor(private http: HttpClient) { 10 | } 11 | 12 | authenticate(credentials, callback) { 13 | 14 | const headers = new HttpHeaders(credentials ? { 15 | authorization : 'Basic ' + btoa(credentials.username + ':' + credentials.password) 16 | } : {}); 17 | 18 | this.http.get('user', {headers: headers}).subscribe(response => { 19 | if (response['name']) { 20 | this.authenticated = true; 21 | } else { 22 | this.authenticated = false; 23 | } 24 | return callback && callback(); 25 | }); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /single/src/app/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | 4 | @Injectable() 5 | export class AppService { 6 | 7 | authenticated = false; 8 | 9 | constructor(private http: HttpClient) { 10 | } 11 | 12 | authenticate(credentials, callback) { 13 | 14 | const headers = new HttpHeaders(credentials ? { 15 | authorization : 'Basic ' + btoa(credentials.username + ':' + credentials.password) 16 | } : {}); 17 | 18 | this.http.get('user', {headers: headers}).subscribe(response => { 19 | if (response['name']) { 20 | this.authenticated = true; 21 | } else { 22 | this.authenticated = false; 23 | } 24 | return callback && callback(); 25 | }); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | 4 | @Injectable() 5 | export class AppService { 6 | 7 | authenticated = false; 8 | 9 | constructor(private http: HttpClient) { 10 | } 11 | 12 | authenticate(credentials, callback) { 13 | 14 | const headers = new HttpHeaders(credentials ? { 15 | authorization : 'Basic ' + btoa(credentials.username + ':' + credentials.password) 16 | } : {}); 17 | 18 | this.http.get('user', {headers: headers}).subscribe(response => { 19 | if (response['name']) { 20 | this.authenticated = true; 21 | } else { 22 | this.authenticated = false; 23 | } 24 | return callback && callback(); 25 | }); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /basic/src/main/java/demo/UiApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import java.util.UUID; 6 | 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @SpringBootApplication 13 | @RestController 14 | public class UiApplication { 15 | 16 | @RequestMapping("/resource") 17 | public Map home() { 18 | Map model = new HashMap(); 19 | model.put("id", UUID.randomUUID().toString()); 20 | model.put("content", "Hello World"); 21 | return model; 22 | } 23 | 24 | public static void main(String[] args) { 25 | SpringApplication.run(UiApplication.class, args); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.springframework.guides 6 | tut-spring-security-and-angular-js 7 | 0.0.1-SNAPSHOT 8 | pom 9 | Spring Security Angular Samples 10 | 11 | 12 | basic 13 | single 14 | vanilla 15 | spring-session 16 | proxy 17 | oauth2-vanilla 18 | oauth2 19 | oauth2-logout 20 | double 21 | modular 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; 3 | 4 | @Injectable() 5 | export class AppService { 6 | 7 | authenticated = false; 8 | 9 | constructor(private http: HttpClient) { 10 | } 11 | 12 | authenticate(credentials, callback) { 13 | 14 | const headers = new HttpHeaders(credentials ? { 15 | 'content-type' : 'application/x-www-form-urlencoded' 16 | } : {}); 17 | const params = new HttpParams() 18 | .set('username', credentials['username']) 19 | .set('password', credentials['password']); 20 | 21 | this.http.post('login', params.toString(), {headers: headers}).subscribe(response => { 22 | this.authenticated = true; 23 | if (callback) { callback(); } 24 | }, () => { 25 | this.authenticated = false; 26 | }); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /oauth2-vanilla/authserver/src/main/java/demo/AuthserverApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.security.Principal; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; 8 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @SpringBootApplication 13 | @RestController 14 | @EnableResourceServer 15 | @EnableAuthorizationServer 16 | public class AuthserverApplication { 17 | 18 | @RequestMapping("/user") 19 | public Principal user(Principal user) { 20 | return user; 21 | } 22 | 23 | public static void main(String[] args) { 24 | SpringApplication.run(AuthserverApplication.class, args); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /double/gateway/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { NgModule, Injectable } from '@angular/core'; 4 | import { 5 | HttpClientModule, HttpInterceptor, HttpHandler, HttpRequest, HTTP_INTERCEPTORS 6 | } from '@angular/common/http'; 7 | 8 | import { AppComponent } from './app.component'; 9 | 10 | @Injectable() 11 | export class XhrInterceptor implements HttpInterceptor { 12 | 13 | intercept(req: HttpRequest, next: HttpHandler) { 14 | const xhr = req.clone({ 15 | headers: req.headers.set('X-Requested-With', 'XMLHttpRequest') 16 | }); 17 | return next.handle(xhr); 18 | } 19 | } 20 | 21 | @NgModule({ 22 | declarations: [ 23 | AppComponent 24 | ], 25 | imports: [ 26 | BrowserModule, 27 | HttpClientModule, 28 | FormsModule 29 | ], 30 | providers: [{ provide: HTTP_INTERCEPTORS, useClass: XhrInterceptor, multi: true }], 31 | bootstrap: [AppComponent] 32 | }) 33 | export class AppModule { } 34 | -------------------------------------------------------------------------------- /basic/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /oauth2/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import 'rxjs/add/operator/finally'; 4 | 5 | @Component({ 6 | selector: 'app-root', 7 | templateUrl: './app.component.html', 8 | styleUrls: ['./app.component.css'] 9 | }) 10 | export class AppComponent { 11 | 12 | title = 'Demo'; 13 | authenticated = false; 14 | greeting = {}; 15 | 16 | constructor(private http: HttpClient) { 17 | this.authenticate(); 18 | } 19 | 20 | authenticate() { 21 | 22 | this.http.get('user').subscribe(response => { 23 | if (response['name']) { 24 | this.authenticated = true; 25 | this.http.get('resource').subscribe(data => this.greeting = data); 26 | } else { 27 | this.authenticated = false; 28 | } 29 | }, () => { this.authenticated = false; }); 30 | 31 | } 32 | logout() { 33 | this.http.post('logout', {}).finally(() => { 34 | this.authenticated = false; 35 | }).subscribe(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /double/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import 'rxjs/add/operator/finally'; 4 | 5 | @Component({ 6 | selector: 'app-root', 7 | templateUrl: './app.component.html', 8 | styleUrls: ['./app.component.css'] 9 | }) 10 | export class AppComponent { 11 | 12 | title = 'Demo'; 13 | authenticated = false; 14 | greeting = {}; 15 | 16 | constructor(private http: HttpClient) { 17 | this.authenticate(); 18 | } 19 | 20 | authenticate() { 21 | 22 | this.http.get('user').subscribe(response => { 23 | if (response['name']) { 24 | this.authenticated = true; 25 | this.http.get('resource').subscribe(data => this.greeting = data); 26 | } else { 27 | this.authenticated = false; 28 | } 29 | }, () => { this.authenticated = false; }); 30 | 31 | } 32 | logout() { 33 | this.http.post('logout', {}).finally(() => { 34 | this.authenticated = false; 35 | }).subscribe(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import 'rxjs/add/operator/finally'; 4 | 5 | @Component({ 6 | selector: 'app-root', 7 | templateUrl: './app.component.html', 8 | styleUrls: ['./app.component.css'] 9 | }) 10 | export class AppComponent { 11 | 12 | title = 'Demo'; 13 | authenticated = false; 14 | greeting = {}; 15 | 16 | constructor(private http: HttpClient) { 17 | this.authenticate(); 18 | } 19 | 20 | authenticate() { 21 | 22 | this.http.get('user').subscribe(response => { 23 | if (response['name']) { 24 | this.authenticated = true; 25 | this.http.get('resource').subscribe(data => this.greeting = data); 26 | } else { 27 | this.authenticated = false; 28 | } 29 | }, () => { this.authenticated = false; }); 30 | 31 | } 32 | logout() { 33 | this.http.post('logout', {}).finally(() => { 34 | this.authenticated = false; 35 | }).subscribe(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /oauth2/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /proxy/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /single/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /vanilla/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /double/admin/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /double/gateway/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /basic/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.context.embedded.LocalServerPort; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 17 | public class ApplicationTests { 18 | 19 | @LocalServerPort 20 | private int port; 21 | 22 | @Test 23 | public void homePageProtected() { 24 | ResponseEntity response = new TestRestTemplate().getForEntity("http://localhost:" + port + "/", String.class); 25 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /double/resource/src/test/java/demo/ResourceTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.security.Principal; 6 | 7 | import org.junit.Test; 8 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 9 | 10 | 11 | public class ResourceTests { 12 | 13 | private ResourceApplication resource = new ResourceApplication(); 14 | 15 | @Test 16 | public void home() { 17 | assertEquals("Hello World", resource.home().getContent()); 18 | } 19 | 20 | @Test 21 | public void changes() { 22 | Principal user = new UsernamePasswordAuthenticationToken("admin", ""); 23 | resource.update(new Message("Foo"), user); 24 | assertEquals(1, resource.changes().size()); 25 | } 26 | 27 | @Test 28 | public void changesOverflow() { 29 | for (int i=1; i<=11; i++) { resource.changes().add(new Change("foo", "bar")); } 30 | Principal user = new UsernamePasswordAuthenticationToken("admin", ""); 31 | resource.update(new Message("Foo"), user); 32 | assertEquals(10, resource.changes().size()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /oauth2-logout/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /spring-session/ui/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /vanilla/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.context.embedded.LocalServerPort; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 17 | public class ApplicationTests { 18 | 19 | @LocalServerPort 20 | private int port; 21 | 22 | private TestRestTemplate template = new TestRestTemplate(); 23 | 24 | @Test 25 | public void resourceLoads() { 26 | ResponseEntity response = template.getForEntity("http://localhost:{port}/", String.class, port); 27 | assertEquals(HttpStatus.OK, response.getStatusCode()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /proxy/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.context.embedded.LocalServerPort; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 17 | public class ApplicationTests { 18 | 19 | @LocalServerPort 20 | private int port; 21 | 22 | private TestRestTemplate template = new TestRestTemplate(); 23 | 24 | @Test 25 | public void resourceLoads() { 26 | ResponseEntity response = template.getForEntity("http://localhost:{port}/", String.class, port); 27 | assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode()); 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /double/gateway/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.context.embedded.LocalServerPort; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 17 | public class ApplicationTests { 18 | 19 | @LocalServerPort 20 | private int port; 21 | 22 | private TestRestTemplate template = new TestRestTemplate(); 23 | 24 | @Test 25 | public void homePageLoads() { 26 | ResponseEntity response = template.getForEntity("http://localhost:" 27 | + port + "/", String.class); 28 | assertEquals(HttpStatus.OK, response.getStatusCode()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spring-session/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.context.embedded.LocalServerPort; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 17 | public class ApplicationTests { 18 | 19 | @LocalServerPort 20 | private int port; 21 | 22 | private TestRestTemplate template = new TestRestTemplate(); 23 | 24 | @Test 25 | public void resourceLoads() { 26 | ResponseEntity response = template.getForEntity("http://localhost:{port}/", String.class, port); 27 | assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode()); 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /vanilla/resource/src/main/java/demo/ResourceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.web.bind.annotation.CrossOrigin; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @SpringBootApplication 12 | @RestController 13 | public class ResourceApplication { 14 | 15 | @RequestMapping("/") 16 | @CrossOrigin(origins="*", maxAge=3600) 17 | public Message home() { 18 | return new Message("Hello World"); 19 | } 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(ResourceApplication.class, args); 23 | } 24 | 25 | } 26 | 27 | class Message { 28 | private String id = UUID.randomUUID().toString(); 29 | private String content; 30 | 31 | Message() { 32 | } 33 | 34 | public Message(String content) { 35 | this.content = content; 36 | } 37 | 38 | public String getId() { 39 | return id; 40 | } 41 | 42 | public String getContent() { 43 | return content; 44 | } 45 | } -------------------------------------------------------------------------------- /oauth2/authserver/src/main/resources/templates/login.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | <#if RequestParameters['error']??> 11 |
12 | There was a problem logging in. Please try again. 13 |
14 | 15 |
16 |
17 |
18 | 19 | 20 |
21 |
22 | 23 | 24 |
25 | 26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /oauth2/resource/src/main/java/demo/ResourceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @SpringBootApplication 12 | @RestController 13 | @EnableResourceServer 14 | public class ResourceApplication { 15 | 16 | @RequestMapping("/") 17 | public Message home() { 18 | return new Message("Hello World"); 19 | } 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(ResourceApplication.class, args); 23 | } 24 | 25 | } 26 | 27 | class Message { 28 | private String id = UUID.randomUUID().toString(); 29 | private String content; 30 | 31 | Message() { 32 | } 33 | 34 | public Message(String content) { 35 | this.content = content; 36 | } 37 | 38 | public String getId() { 39 | return id; 40 | } 41 | 42 | public String getContent() { 43 | return content; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /oauth2-logout/resource/src/main/java/demo/ResourceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @SpringBootApplication 12 | @RestController 13 | @EnableResourceServer 14 | public class ResourceApplication { 15 | 16 | @RequestMapping("/") 17 | public Message home() { 18 | return new Message("Hello World"); 19 | } 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(ResourceApplication.class, args); 23 | } 24 | 25 | } 26 | 27 | class Message { 28 | private String id = UUID.randomUUID().toString(); 29 | private String content; 30 | 31 | Message() { 32 | } 33 | 34 | public Message(String content) { 35 | this.content = content; 36 | } 37 | 38 | public String getId() { 39 | return id; 40 | } 41 | 42 | public String getContent() { 43 | return content; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /oauth2-vanilla/resource/src/main/java/demo/ResourceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @SpringBootApplication 12 | @RestController 13 | @EnableResourceServer 14 | public class ResourceApplication { 15 | 16 | @RequestMapping("/") 17 | public Message home() { 18 | return new Message("Hello World"); 19 | } 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(ResourceApplication.class, args); 23 | } 24 | 25 | } 26 | 27 | class Message { 28 | private String id = UUID.randomUUID().toString(); 29 | private String content; 30 | 31 | Message() { 32 | } 33 | 34 | public Message(String content) { 35 | this.content = content; 36 | } 37 | 38 | public String getId() { 39 | return id; 40 | } 41 | 42 | public String getContent() { 43 | return content; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /basic/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /oauth2-logout/authserver/src/main/resources/templates/login.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | <#if RequestParameters['error']??> 11 |
12 | There was a problem logging in. Please try again. 13 |
14 | 15 |
16 |
17 |
18 | 19 | 20 |
21 |
22 | 23 | 24 |
25 | 26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /double/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /oauth2/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /proxy/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /single/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /vanilla/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /double/admin/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /double/gateway/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /double/admin/src/app/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; 3 | 4 | @Injectable() 5 | export class AppService { 6 | 7 | error: string; 8 | writer: boolean; 9 | authenticated = false; 10 | 11 | constructor(private http: HttpClient) { 12 | } 13 | 14 | authenticate(callback) { 15 | 16 | this.http.get('/user').subscribe(user => { 17 | if (user['name']) { 18 | this.authenticated = true; 19 | this.writer = user['roles'] && user['roles'].indexOf('ROLE_WRITER') > 0; 20 | } else { 21 | this.authenticated = false; 22 | this.writer = false; 23 | } 24 | if (callback) { callback(user); } 25 | }, response => { 26 | if (response.status === 0) { 27 | this.error = 'No connection. Verify application is running.'; 28 | } else if (response.status === 401) { 29 | this.error = 'Unauthorized.'; 30 | } else if (response.status === 403) { 31 | this.error = 'Forbidden.'; 32 | } else { 33 | this.error = 'Unknown.'; 34 | } 35 | this.authenticated = false; 36 | this.writer = false; 37 | }); 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | aop: 3 | proxy-target-class: true 4 | 5 | 6 | security: 7 | user: 8 | password: none 9 | ignored: 10 | - "*.bundle.*" 11 | oauth2: 12 | client: 13 | accessTokenUri: http://localhost:9999/uaa/oauth/token 14 | userAuthorizationUri: http://localhost:9999/uaa/oauth/authorize 15 | clientId: acme 16 | clientSecret: acmesecret 17 | resource: 18 | jwt: 19 | keyValue: | 20 | -----BEGIN PUBLIC KEY----- 21 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGp/Q5lh0P8nPL21oMMrt2RrkT9AW5jgYwLfSUnJVc9G6uR3cXRRDCjHqWU5WYwivcF180A6CWp/ireQFFBNowgc5XaA0kPpzEtgsA5YsNX7iSnUibB004iBTfU9hZ2Rbsc8cWqynT0RyN4TP1RYVSeVKvMQk4GT1r7JCEC+TNu1ELmbNwMQyzKjsfBXyIOCFU/E94ktvsTZUHF4Oq44DBylCDsS1k7/sfZC2G5EU7Oz0mhG8+Uz6MSEQHtoIi6mc8u64Rwi3Z3tscuWG2ShtsUFuNSAFNkY7LkLn+/hxLCu2bNISMaESa8dG22CIMuIeRLVcAmEWEWH5EEforTg+QIDAQAB 22 | -----END PUBLIC KEY----- 23 | 24 | zuul: 25 | routes: 26 | resource: 27 | path: /resource/** 28 | url: http://localhost:9000 29 | user: 30 | path: /user/** 31 | url: http://localhost:9999/uaa/user 32 | 33 | logging: 34 | level: 35 | org.springframework.security: DEBUG -------------------------------------------------------------------------------- /oauth2-logout/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /oauth2-vanilla/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /oauth2/ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | aop: 3 | proxy-target-class: true 4 | 5 | 6 | security: 7 | user: 8 | password: none 9 | ignored: 10 | - "*.bundle.*" 11 | oauth2: 12 | client: 13 | accessTokenUri: http://localhost:9999/uaa/oauth/token 14 | userAuthorizationUri: http://localhost:9999/uaa/oauth/authorize 15 | clientId: acme 16 | clientSecret: acmesecret 17 | resource: 18 | jwt: 19 | keyValue: | 20 | -----BEGIN PUBLIC KEY----- 21 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGp/Q5lh0P8nPL21oMMrt2RrkT9AW5jgYwLfSUnJVc9G6uR3cXRRDCjHqWU5WYwivcF180A6CWp/ireQFFBNowgc5XaA0kPpzEtgsA5YsNX7iSnUibB004iBTfU9hZ2Rbsc8cWqynT0RyN4TP1RYVSeVKvMQk4GT1r7JCEC+TNu1ELmbNwMQyzKjsfBXyIOCFU/E94ktvsTZUHF4Oq44DBylCDsS1k7/sfZC2G5EU7Oz0mhG8+Uz6MSEQHtoIi6mc8u64Rwi3Z3tscuWG2ShtsUFuNSAFNkY7LkLn+/hxLCu2bNISMaESa8dG22CIMuIeRLVcAmEWEWH5EEforTg+QIDAQAB 22 | -----END PUBLIC KEY----- 23 | 24 | zuul: 25 | routes: 26 | resource: 27 | path: /resource/** 28 | url: http://localhost:9000 29 | user: 30 | path: /user/** 31 | url: http://localhost:9999/uaa/user 32 | 33 | logging: 34 | level: 35 | org.springframework.security: DEBUG 36 | -------------------------------------------------------------------------------- /spring-session/ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /single/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [HttpClientTestingModule], 8 | declarations: [ 9 | AppComponent 10 | ] 11 | }).compileComponents(); 12 | })); 13 | it('should create the app', async(() => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | })); 18 | it(`should have as title 'app'`, async(() => { 19 | const fixture = TestBed.createComponent(AppComponent); 20 | const app = fixture.debugElement.componentInstance; 21 | expect(app.title).toEqual('Demo'); 22 | })); 23 | it('should render title in a h1 tag', async(() => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.debugElement.nativeElement; 27 | expect(compiled.querySelector('h1').textContent).toContain('Welcome Demo!'); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /double/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.context.embedded.LocalServerPort; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 18 | public class ApplicationTests { 19 | 20 | @LocalServerPort 21 | private int port; 22 | 23 | private TestRestTemplate template = new TestRestTemplate(); 24 | 25 | @Test 26 | public void resourceProtected() { 27 | ResponseEntity response = template.getForEntity("http://localhost:{port}/", String.class, port); 28 | // N.B. better if it was UNAUTHORIZED but that means we have to add a custom authentication entry point 29 | assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /proxy/ui/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [HttpClientTestingModule], 8 | declarations: [ 9 | AppComponent 10 | ] 11 | }).compileComponents(); 12 | })); 13 | it('should create the app', async(() => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | })); 18 | it(`should have as title 'app'`, async(() => { 19 | const fixture = TestBed.createComponent(AppComponent); 20 | const app = fixture.debugElement.componentInstance; 21 | expect(app.title).toEqual('Demo'); 22 | })); 23 | it('should render title in a h1 tag', async(() => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.debugElement.nativeElement; 27 | expect(compiled.querySelector('h1').textContent).toContain('Welcome Demo!'); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /vanilla/ui/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [HttpClientTestingModule], 8 | declarations: [ 9 | AppComponent 10 | ] 11 | }).compileComponents(); 12 | })); 13 | it('should create the app', async(() => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | })); 18 | it(`should have as title 'app'`, async(() => { 19 | const fixture = TestBed.createComponent(AppComponent); 20 | const app = fixture.debugElement.componentInstance; 21 | expect(app.title).toEqual('Demo'); 22 | })); 23 | it('should render title in a h1 tag', async(() => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.debugElement.nativeElement; 27 | expect(compiled.querySelector('h1').textContent).toContain('Welcome Demo!'); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /double/admin/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [HttpClientTestingModule], 8 | declarations: [ 9 | AppComponent 10 | ] 11 | }).compileComponents(); 12 | })); 13 | it('should create the app', async(() => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | })); 18 | it(`should have as title 'app'`, async(() => { 19 | const fixture = TestBed.createComponent(AppComponent); 20 | const app = fixture.debugElement.componentInstance; 21 | expect(app.title).toEqual('Demo'); 22 | })); 23 | it('should render title in a h1 tag', async(() => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.debugElement.nativeElement; 27 | expect(compiled.querySelector('h1').textContent).toContain('Welcome Demo!'); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /spring-session/ui/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [HttpClientTestingModule], 8 | declarations: [ 9 | AppComponent 10 | ] 11 | }).compileComponents(); 12 | })); 13 | it('should create the app', async(() => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | })); 18 | it(`should have as title 'app'`, async(() => { 19 | const fixture = TestBed.createComponent(AppComponent); 20 | const app = fixture.debugElement.componentInstance; 21 | expect(app.title).toEqual('Demo'); 22 | })); 23 | it('should render title in a h1 tag', async(() => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.debugElement.nativeElement; 27 | expect(compiled.querySelector('h1').textContent).toContain('Welcome Demo!'); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /oauth2-logout/ui/src/main/java/demo/UiApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 6 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 8 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 9 | import org.springframework.security.web.csrf.CookieCsrfTokenRepository; 10 | 11 | @SpringBootApplication 12 | @EnableZuulProxy 13 | @EnableOAuth2Sso 14 | public class UiApplication extends WebSecurityConfigurerAdapter { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(UiApplication.class, args); 18 | } 19 | 20 | @Override 21 | public void configure(HttpSecurity http) throws Exception { 22 | // @formatter:off 23 | http 24 | .logout().and() 25 | .authorizeRequests() 26 | .antMatchers("/index.html", "/", "/login").permitAll() 27 | .anyRequest().authenticated() 28 | .and() 29 | .csrf() 30 | .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()); 31 | // @formatter:on 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /double/gateway/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'] 8 | }) 9 | export class AppComponent { 10 | 11 | admin: boolean; 12 | user: any; 13 | title = 'Demo'; 14 | credentials = {username: '', password: ''}; 15 | authenticated = false; 16 | 17 | constructor(private http: HttpClient) { 18 | this.login(); 19 | } 20 | 21 | login() { 22 | const headers = this.credentials.username ? new HttpHeaders().set( 23 | 'authorization', 'Basic ' + btoa(this.credentials.username + ':' + this.credentials.password) 24 | ) : new HttpHeaders(); 25 | this.http.get('user', {headers: headers}).subscribe(data => { 26 | this.authenticated = data && data['name']; 27 | this.user = this.authenticated ? data['name'] : ''; 28 | this.admin = this.authenticated && data['roles'] && data['roles'].indexOf('ROLE_ADMIN') > -1; 29 | }); 30 | return false; 31 | } 32 | 33 | logout() { 34 | this.http.post('logout', {}).subscribe(function() { 35 | this.authenticated = false; 36 | this.admin = false; 37 | }); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /oauth2-vanilla/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.boot.context.embedded.LocalServerPort; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 11 | import org.springframework.boot.test.web.client.TestRestTemplate; 12 | import org.springframework.http.HttpStatus; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 18 | public class ApplicationTests { 19 | 20 | @LocalServerPort 21 | private int port; 22 | 23 | private TestRestTemplate template = new TestRestTemplate(); 24 | 25 | @Test 26 | public void resourceLoads() { 27 | ResponseEntity response = template.getForEntity("http://localhost:{port}/", String.class, port); 28 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 29 | String auth = response.getHeaders().getFirst("WWW-Authenticate"); 30 | assertTrue("Wrong header: " + auth , auth.startsWith("Bearer")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /oauth2/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.boot.context.embedded.LocalServerPort; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 11 | import org.springframework.boot.test.web.client.TestRestTemplate; 12 | import org.springframework.http.HttpStatus; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 18 | public class ApplicationTests { 19 | 20 | @LocalServerPort 21 | private int port; 22 | 23 | private TestRestTemplate template = new TestRestTemplate(); 24 | 25 | @Test 26 | public void resourceLoads() { 27 | ResponseEntity response = template.getForEntity("http://localhost:{port}/resource/", String.class, port); 28 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 29 | String auth = response.getHeaders().getFirst("WWW-Authenticate"); 30 | assertTrue("Wrong header: " + auth , auth.startsWith("Bearer")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /proxy/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "java", 9 | "name": "Debug (Launch)-ResourceApplication", 10 | "request": "launch", 11 | "cwd": "${workspaceFolder}", 12 | "console": "internalConsole", 13 | "stopOnEntry": false, 14 | "mainClass": "demo.ResourceApplication", 15 | "projectName": "proxy-resource", 16 | "args": "" 17 | }, 18 | { 19 | "type": "java", 20 | "name": "Debug (Launch)-UiApplication", 21 | "request": "launch", 22 | "cwd": "${workspaceFolder}", 23 | "console": "internalConsole", 24 | "stopOnEntry": false, 25 | "mainClass": "demo.UiApplication", 26 | "projectName": "proxy-ui", 27 | "args": "" 28 | }, 29 | { 30 | "type": "java", 31 | "name": "Debug (Attach)", 32 | "request": "attach", 33 | "hostName": "localhost", 34 | "port": 0 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /oauth2-logout/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.boot.context.embedded.LocalServerPort; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 11 | import org.springframework.boot.test.web.client.TestRestTemplate; 12 | import org.springframework.http.HttpStatus; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 18 | public class ApplicationTests { 19 | 20 | @LocalServerPort 21 | private int port; 22 | 23 | private TestRestTemplate template = new TestRestTemplate(); 24 | 25 | @Test 26 | public void resourceLoads() { 27 | ResponseEntity response = template.getForEntity("http://localhost:{port}/resource/", String.class, port); 28 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 29 | String auth = response.getHeaders().getFirst("WWW-Authenticate"); 30 | assertTrue("Wrong header: " + auth , auth.startsWith("Bearer")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-session/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "java", 9 | "name": "Debug (Launch)-ResourceApplication", 10 | "request": "launch", 11 | "cwd": "${workspaceFolder}", 12 | "console": "internalConsole", 13 | "stopOnEntry": false, 14 | "mainClass": "demo.ResourceApplication", 15 | "projectName": "spring-session-resource", 16 | "args": "" 17 | }, 18 | { 19 | "type": "java", 20 | "name": "Debug (Launch)-UiApplication", 21 | "request": "launch", 22 | "cwd": "${workspaceFolder}", 23 | "console": "internalConsole", 24 | "stopOnEntry": false, 25 | "mainClass": "demo.UiApplication", 26 | "projectName": "spring-session-ui", 27 | "args": "" 28 | }, 29 | { 30 | "type": "java", 31 | "name": "Debug (Attach)", 32 | "request": "attach", 33 | "hostName": "localhost", 34 | "port": 0 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /double/admin/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AppService } from './app.service'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Router } from '@angular/router'; 5 | import 'rxjs/add/operator/finally'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.css'] 11 | }) 12 | export class AppComponent { 13 | 14 | user: {}; 15 | 16 | constructor(private app: AppService, private http: HttpClient, private router: Router) { 17 | app.authenticate(response => { 18 | this.user = response; 19 | this.message(); 20 | }); 21 | } 22 | 23 | logout() { 24 | this.http.post('logout', {}).subscribe(function() { 25 | this.app.authenticated = false; 26 | this.router.navigateByUrl('/login'); 27 | }); 28 | } 29 | 30 | message() { 31 | if (!this.app.authenticated) { 32 | this.router.navigate(['/unauthenticated']); 33 | } else { 34 | if (this.app.writer) { 35 | this.router.navigate(['/write']); 36 | } else { 37 | this.router.navigate(['/read']); 38 | } 39 | } 40 | } 41 | 42 | changes() { 43 | if (!this.app.authenticated) { 44 | this.router.navigate(['/unauthenticated']); 45 | } else { 46 | this.router.navigate(['/changes']); 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /oauth2/authserver/src/main/resources/templates/authorize.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 |
11 |

Please Confirm

12 | 13 |

14 | Do you authorize "${authorizationRequest.clientId}" at "${authorizationRequest.redirectUri}" to access your protected resources 15 | with scope ${authorizationRequest.scope?join(", ")}. 16 |

17 |
19 | 20 | 21 | 22 |
23 |
25 | 26 | 27 | 28 |
29 |
30 | 31 | --------------------------------------------------------------------------------