├── projects
├── sample-code-flow
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.component.spec.ts
│ │ │ └── app.component.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── main.ts
│ │ ├── test.ts
│ │ └── silent-renew.html
│ ├── tsconfig.app.json
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-code-flow-auto-login
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── home
│ │ │ │ ├── home.component.css
│ │ │ │ ├── home.component.html
│ │ │ │ ├── home.component.ts
│ │ │ │ └── home.component.spec.ts
│ │ │ ├── forbidden
│ │ │ │ ├── forbidden.component.css
│ │ │ │ ├── forbidden.component.html
│ │ │ │ ├── forbidden.component.ts
│ │ │ │ └── forbidden.component.spec.ts
│ │ │ ├── protected
│ │ │ │ ├── protected.component.css
│ │ │ │ ├── protected.component.html
│ │ │ │ ├── protected.component.ts
│ │ │ │ └── protected.component.spec.ts
│ │ │ ├── auto-login
│ │ │ │ ├── auto-login.component.css
│ │ │ │ ├── auto-login.component.html
│ │ │ │ ├── auto-login.component.ts
│ │ │ │ └── auto-login.component.spec.ts
│ │ │ ├── unauthorized
│ │ │ │ ├── unauthorized.component.css
│ │ │ │ ├── unauthorized.component.html
│ │ │ │ ├── unauthorized.component.ts
│ │ │ │ └── unauthorized.component.spec.ts
│ │ │ ├── navigation
│ │ │ │ ├── navigation.component.css
│ │ │ │ ├── navigation.component.spec.ts
│ │ │ │ ├── navigation.component.ts
│ │ │ │ └── navigation.component.html
│ │ │ ├── app.component.html
│ │ │ ├── app.routes.ts
│ │ │ ├── app.component.spec.ts
│ │ │ └── authorization.guard.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── silent-renew.html
│ │ ├── test.ts
│ │ └── index.html
│ ├── tsconfig.app.json
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-code-flow-http-config
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ └── app.component.spec.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── index.html
│ │ ├── test.ts
│ │ └── silent-renew.html
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tsconfig.app.json
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-implicit-flow-ad-b2c
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── forbidden
│ │ │ │ ├── forbidden.component.css
│ │ │ │ ├── forbidden.component.html
│ │ │ │ ├── forbidden.component.ts
│ │ │ │ └── forbidden.component.spec.ts
│ │ │ ├── protected
│ │ │ │ ├── protected.component.css
│ │ │ │ ├── protected.component.html
│ │ │ │ ├── protected.component.ts
│ │ │ │ └── protected.component.spec.ts
│ │ │ ├── auto-login
│ │ │ │ ├── auto-login.component.css
│ │ │ │ ├── auto-login.component.html
│ │ │ │ ├── auto-login.component.ts
│ │ │ │ └── auto-login.component.spec.ts
│ │ │ ├── unauthorized
│ │ │ │ ├── unauthorized.component.css
│ │ │ │ ├── unauthorized.component.html
│ │ │ │ ├── unauthorized.component.ts
│ │ │ │ └── unauthorized.component.spec.ts
│ │ │ ├── home
│ │ │ │ ├── home.component.html
│ │ │ │ └── home.component.ts
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.routes.ts
│ │ │ ├── authorization.guard.ts
│ │ │ └── nav-menu
│ │ │ │ ├── nav-menu.component.ts
│ │ │ │ ├── nav-menu.component.html
│ │ │ │ └── nav-menu.component.css
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── silent-renew.html
│ │ ├── test.ts
│ │ └── index.html
│ ├── tsconfig.app.json
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-implicit-flow-azuread
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── auto-login
│ │ │ │ ├── auto-login.component.css
│ │ │ │ ├── auto-login.component.html
│ │ │ │ ├── auto-login.component.ts
│ │ │ │ └── auto-login.component.spec.ts
│ │ │ ├── forbidden
│ │ │ │ ├── forbidden.component.css
│ │ │ │ ├── forbidden.component.html
│ │ │ │ ├── forbidden.component.ts
│ │ │ │ └── forbidden.component.spec.ts
│ │ │ ├── protected
│ │ │ │ ├── protected.component.css
│ │ │ │ ├── protected.component.html
│ │ │ │ ├── protected.component.ts
│ │ │ │ └── protected.component.spec.ts
│ │ │ ├── unauthorized
│ │ │ │ ├── unauthorized.component.css
│ │ │ │ ├── unauthorized.component.html
│ │ │ │ ├── unauthorized.component.ts
│ │ │ │ └── unauthorized.component.spec.ts
│ │ │ ├── home
│ │ │ │ ├── home.component.html
│ │ │ │ └── home.component.ts
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.routes.ts
│ │ │ ├── authorization.guard.ts
│ │ │ └── nav-menu
│ │ │ │ ├── nav-menu.component.ts
│ │ │ │ ├── nav-menu.component.html
│ │ │ │ └── nav-menu.component.css
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── silent-renew.html
│ │ ├── test.ts
│ │ └── index.html
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tsconfig.app.json
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-implicit-flow-google
│ ├── src
│ │ ├── assets
│ │ │ ├── .gitkeep
│ │ │ └── damienbod.jpg
│ │ ├── app
│ │ │ ├── auto-login
│ │ │ │ ├── auto-login.component.html
│ │ │ │ └── auto-login.component.ts
│ │ │ ├── forbidden
│ │ │ │ ├── forbidden.component.html
│ │ │ │ └── forbidden.component.ts
│ │ │ ├── unauthorized
│ │ │ │ ├── unauthorized.component.html
│ │ │ │ └── unauthorized.component.ts
│ │ │ ├── home
│ │ │ │ ├── home.component.html
│ │ │ │ └── home.component.ts
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.routes.ts
│ │ │ ├── navigation
│ │ │ │ ├── navigation.component.ts
│ │ │ │ └── navigation.component.html
│ │ │ └── app.component.spec.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── silent-renew.html
│ │ ├── test.ts
│ │ └── index.html
│ ├── tsconfig.app.json
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-code-flow-refresh-tokens
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.component.spec.ts
│ │ │ └── app.component.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── index.html
│ │ └── test.ts
│ ├── tsconfig.app.json
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
├── sample-implicit-flow-silent-renew
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.component.spec.ts
│ │ │ └── app.component.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── index.html
│ │ ├── silent-renew.html
│ │ └── test.ts
│ ├── e2e
│ │ ├── tsconfig.json
│ │ ├── src
│ │ │ ├── app.po.ts
│ │ │ └── app.e2e-spec.ts
│ │ └── protractor.conf.js
│ ├── tsconfig.app.json
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ └── karma.conf.js
└── angular-auth-oidc-client
│ ├── src
│ ├── lib
│ │ ├── logging
│ │ │ ├── log-level.ts
│ │ │ ├── logger.service-mock.ts
│ │ │ └── logger.service.ts
│ │ ├── public-events
│ │ │ ├── index.ts
│ │ │ ├── notification.ts
│ │ │ ├── event-types.ts
│ │ │ └── public-events.service.ts
│ │ ├── iframe
│ │ │ ├── index.ts
│ │ │ └── silent-renew.service.ts
│ │ ├── utils
│ │ │ ├── platform-provider
│ │ │ │ ├── platform.provider-mock.ts
│ │ │ │ ├── platform.provider.ts
│ │ │ │ └── platform-provider.spec.ts
│ │ │ ├── index.ts
│ │ │ ├── window
│ │ │ │ └── window.reference.ts
│ │ │ ├── redirect
│ │ │ │ ├── redirect.service.ts
│ │ │ │ └── redirect.service.spec.ts
│ │ │ ├── url
│ │ │ │ └── uri-encoder.ts
│ │ │ └── flowHelper
│ │ │ │ └── flow-helper.service.ts
│ │ ├── storage
│ │ │ ├── index.ts
│ │ │ ├── browser-storage.service-mock.ts
│ │ │ └── abstract-security-storage.ts
│ │ ├── auth-options.ts
│ │ ├── authState
│ │ │ ├── authorized-state.ts
│ │ │ └── authorization-result.ts
│ │ ├── config
│ │ │ ├── index.ts
│ │ │ ├── public-configuration.ts
│ │ │ ├── auth-well-known-endpoints.ts
│ │ │ ├── config.provider-mock.ts
│ │ │ ├── openid-configuration.ts
│ │ │ └── default-config.ts
│ │ ├── validation
│ │ │ ├── jwtkeys.ts
│ │ │ ├── state-validation-result.ts
│ │ │ └── validation-result.ts
│ │ ├── api
│ │ │ ├── data.service-mock.ts
│ │ │ ├── http-base.service.ts
│ │ │ └── data.service.ts
│ │ ├── flows
│ │ │ ├── callback-context.ts
│ │ │ └── random
│ │ │ │ └── random.service.ts
│ │ └── angular-auth-oidc-client.ts
│ ├── public-api.ts
│ └── test.ts
│ ├── tsconfig.lib.prod.json
│ ├── tslint.json
│ ├── tsconfig.spec.json
│ ├── ng-package.json
│ ├── tsconfig.lib.json
│ ├── karma.conf.js
│ └── package.json
├── license-banner.txt
├── certs
├── dev_localhost.pfx
├── Readme.md
├── dev_localhost.pem
└── dev_localhost.key
├── .prettierrc
├── docs
├── references.md
├── logout.md
├── authorizing-popup-iframe.md
├── csp-cors-config.md
└── guards.md
├── .editorconfig
├── .github
└── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── tsconfig.json
├── .travis.yml
├── .vscode
└── settings.json
├── .gitignore
└── LICENSE
/projects/sample-code-flow/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/home/home.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/forbidden/forbidden.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/protected/protected.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/forbidden/forbidden.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/protected/protected.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/auto-login/auto-login.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/auto-login/auto-login.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/auto-login/auto-login.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/forbidden/forbidden.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/protected/protected.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/unauthorized/unauthorized.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/unauthorized/unauthorized.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/unauthorized/unauthorized.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/license-banner.txt:
--------------------------------------------------------------------------------
1 | /**
2 | * @license angular-auth-oidc-client
3 | * MIT license
4 | */
5 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/auto-login/auto-login.component.html:
--------------------------------------------------------------------------------
1 |
redirecting to login
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/auto-login/auto-login.component.html:
--------------------------------------------------------------------------------
1 | redirecting to login
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/auto-login/auto-login.component.html:
--------------------------------------------------------------------------------
1 | redirecting to login
--------------------------------------------------------------------------------
/certs/dev_localhost.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/certs/dev_localhost.pfx
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/auto-login/auto-login.component.html:
--------------------------------------------------------------------------------
1 | redirecting to login
2 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/protected/protected.component.html:
--------------------------------------------------------------------------------
1 |
2 | protected works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/forbidden/forbidden.component.html:
--------------------------------------------------------------------------------
1 |
2 | forbidden works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/protected/protected.component.html:
--------------------------------------------------------------------------------
1 |
2 | protected works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/forbidden/forbidden.component.html:
--------------------------------------------------------------------------------
1 |
2 | forbidden works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/protected/protected.component.html:
--------------------------------------------------------------------------------
1 |
2 | protected works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/navigation/navigation.component.css:
--------------------------------------------------------------------------------
1 | li a {
2 | cursor: pointer;
3 | }
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/unauthorized/unauthorized.component.html:
--------------------------------------------------------------------------------
1 |
2 | unauthorized works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/unauthorized/unauthorized.component.html:
--------------------------------------------------------------------------------
1 |
2 | unauthorized works!
3 |
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/forbidden/forbidden.component.html:
--------------------------------------------------------------------------------
1 | 403: You have no rights to access this.
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "es5",
4 | "printWidth": 140,
5 | "tabWidth": 4
6 | }
7 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/logging/log-level.ts:
--------------------------------------------------------------------------------
1 | export enum LogLevel {
2 | Debug,
3 | Warn,
4 | Error,
5 | }
6 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/unauthorized/unauthorized.component.html:
--------------------------------------------------------------------------------
1 | 401: You have no rights to access this. Please Login
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/unauthorized/unauthorized.component.html:
--------------------------------------------------------------------------------
1 | 401: You have no rights to access this. Please Login
--------------------------------------------------------------------------------
/certs/Readme.md:
--------------------------------------------------------------------------------
1 | double click the pfx on a windows mc and use the 1234 password to install.
2 |
3 | The certificates are configured in the angular.json
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-code-flow/src/favicon.ico
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/public-api.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Public API Surface of angular-auth-oidc-client
3 | */
4 |
5 | export * from './lib/angular-auth-oidc-client';
6 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/tsconfig.lib.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.lib.json",
3 | "angularCompilerOptions": {
4 | "enableIvy": false
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-code-flow-auto-login/src/favicon.ico
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-code-flow-http-config/src/favicon.ico
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-implicit-flow-ad-b2c/src/favicon.ico
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-implicit-flow-azuread/src/favicon.ico
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-implicit-flow-google/src/favicon.ico
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/public-events/index.ts:
--------------------------------------------------------------------------------
1 | export * from './event-types';
2 | export * from './notification';
3 | export * from './public-events.service';
4 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-code-flow-refresh-tokens/src/favicon.ico
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-implicit-flow-silent-renew/src/favicon.ico
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/assets/damienbod.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/piraces/angular-auth-oidc-client/master/projects/sample-implicit-flow-google/src/assets/damienbod.jpg
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/iframe/index.ts:
--------------------------------------------------------------------------------
1 | export * from './check-session.service';
2 | export * from './existing-iframe.service';
3 | export * from './silent-renew.service';
4 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/platform-provider/platform.provider-mock.ts:
--------------------------------------------------------------------------------
1 | export class PlatformProviderMock {
2 | get isBrowser() {
3 | return true;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/storage/index.ts:
--------------------------------------------------------------------------------
1 | export * from './abstract-security-storage';
2 | export * from './browser-storage.service';
3 | export * from './storage-persistance.service';
4 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from './platform-provider/platform.provider';
2 | export * from './redirect/redirect.service';
3 | export * from './url/url.service';
4 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/auth-options.ts:
--------------------------------------------------------------------------------
1 | export interface AuthOptions {
2 | customParams?: { [key: string]: string | number | boolean };
3 | urlHandler?(url: string): any;
4 | }
5 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 | Welcome
2 |
3 |
4 | Is Authenticated: {{ isAuthenticated$ | async }}
5 | {{ userData$ | async | json }}
6 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 | Welcome
2 |
3 |
4 | Is Authenticated: {{ isAuthenticated$ | async }}
5 | {{ userData$ | async | json }}
6 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 | Welcome
2 |
3 |
4 | Is Authenticated: {{ isAuthenticated$ | async }}
5 | {{ userData$ | async | json }}
6 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/authState/authorized-state.ts:
--------------------------------------------------------------------------------
1 | export enum AuthorizedState {
2 | Authorized = 'Authorized',
3 | Unauthorized = 'Unauthorized',
4 | Unknown = 'Unknown',
5 | }
6 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/config/index.ts:
--------------------------------------------------------------------------------
1 | export * from './config.provider';
2 | export * from './config.service';
3 | export * from './openid-configuration';
4 | export * from './public-configuration';
5 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 | Welcome to home Route
2 |
3 |
4 | Is Authenticated: {{ isAuthenticated$ | async }}
5 | {{ userData$ | async | json }}
6 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/public-events/notification.ts:
--------------------------------------------------------------------------------
1 | import { EventTypes } from './event-types';
2 |
3 | export interface OidcClientNotification {
4 | type: EventTypes;
5 | value?: T;
6 | }
7 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/forbidden/forbidden.component.html:
--------------------------------------------------------------------------------
1 |
2 | Normally you should not see this but your
3 |
authenticated
4 | is {{ authenticated$ | async }} :-)
5 |
6 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | @media (max-width: 767px) {
2 | /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */
3 | .body-content {
4 | padding-top: 50px;
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | @media (max-width: 767px) {
2 | /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */
3 | .body-content {
4 | padding-top: 50px;
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 0;
3 | }
4 |
5 | .starter-template {
6 | padding: 40px 15px;
7 | text-align: center;
8 | }
9 |
10 | .navigationLinkButton:hover {
11 | cursor: pointer;
12 | }
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/window/window.reference.ts:
--------------------------------------------------------------------------------
1 | import { InjectionToken } from '@angular/core';
2 |
3 | export function _window(): any {
4 | return window;
5 | }
6 |
7 | export const WINDOW = new InjectionToken('WindowToken');
8 |
--------------------------------------------------------------------------------
/docs/references.md:
--------------------------------------------------------------------------------
1 | # Useful links and references
2 |
3 | ## Examples using:
4 |
5 | https://github.com/damienbod/AspNetCoreAngularSignalRSecurity
6 |
7 | ## Using src code directly:
8 |
9 | https://github.com/damienbod/AspNet5IdentityServerAngularImplicitFlow
10 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/validation/jwtkeys.ts:
--------------------------------------------------------------------------------
1 | export class JwtKeys {
2 | keys: JwtKey[] = [];
3 | }
4 |
5 | export class JwtKey {
6 | kty = '';
7 | use = '';
8 | kid = '';
9 | x5t = '';
10 | e = '';
11 | n = '';
12 | x5c: any[] = [];
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/config/public-configuration.ts:
--------------------------------------------------------------------------------
1 | import { AuthWellKnownEndpoints } from './auth-well-known-endpoints';
2 | import { OpenIdConfiguration } from './openid-configuration';
3 |
4 | export interface PublicConfiguration {
5 | configuration: OpenIdConfiguration;
6 | wellknown: AuthWellKnownEndpoints;
7 | }
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://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 | [*.ts]
12 | quote_type = single
13 |
14 | [*.md]
15 | max_line_length = off
16 | trim_trailing_whitespace = false
17 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/public-events/event-types.ts:
--------------------------------------------------------------------------------
1 | export enum EventTypes {
2 | /**
3 | * This only works in the AppModule Constructor
4 | */
5 | ConfigLoaded,
6 | CheckSessionReceived,
7 | UserDataChanged,
8 | NewAuthorizationResult,
9 | TokenExpired,
10 | IdTokenExpired,
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "lib",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "lib",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/authState/authorization-result.ts:
--------------------------------------------------------------------------------
1 | import { ValidationResult } from '../validation/validation-result';
2 | import { AuthorizedState } from './authorized-state';
3 |
4 | export interface AuthorizationResult {
5 | authorizationState: AuthorizedState;
6 | validationResult: ValidationResult;
7 | isRenewProcess: boolean;
8 | }
9 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts"
12 | ],
13 | "include": [
14 | "**/*.spec.ts",
15 | "**/*.d.ts"
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo(): Promise {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText(): Promise {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/protected/protected.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-protected',
5 | templateUrl: './protected.component.html',
6 | styleUrls: ['./protected.component.css']
7 | })
8 | export class ProtectedComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/forbidden/forbidden.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-forbidden',
5 | templateUrl: './forbidden.component.html',
6 | styleUrls: ['./forbidden.component.css']
7 | })
8 | export class ForbiddenComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/protected/protected.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-protected',
5 | templateUrl: './protected.component.html',
6 | styleUrls: ['./protected.component.css']
7 | })
8 | export class ProtectedComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/forbidden/forbidden.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-forbidden',
5 | templateUrl: './forbidden.component.html',
6 | styleUrls: ['./forbidden.component.css']
7 | })
8 | export class ForbiddenComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/protected/protected.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-protected',
5 | templateUrl: './protected.component.html',
6 | styleUrls: ['./protected.component.css']
7 | })
8 | export class ProtectedComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/redirect/redirect.service.ts:
--------------------------------------------------------------------------------
1 | import { Inject, Injectable } from '@angular/core';
2 | import { WINDOW } from '../window/window.reference';
3 |
4 | @Injectable({ providedIn: 'root' })
5 | export class RedirectService {
6 | constructor(@Inject(WINDOW) private window: any) {}
7 |
8 | redirectTo(url) {
9 | this.window.location.href = url;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/config/auth-well-known-endpoints.ts:
--------------------------------------------------------------------------------
1 | export interface AuthWellKnownEndpoints {
2 | issuer?: string;
3 | jwksUri?: string;
4 | authorizationEndpoint?: string;
5 | tokenEndpoint?: string;
6 | userinfoEndpoint?: string;
7 | endSessionEndpoint?: string;
8 | checkSessionIframe?: string;
9 | revocationEndpoint?: string;
10 | introspectionEndpoint?: string;
11 | }
12 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/platform-provider/platform.provider.ts:
--------------------------------------------------------------------------------
1 | import { isPlatformBrowser } from '@angular/common';
2 | import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
3 |
4 | @Injectable()
5 | export class PlatformProvider {
6 | get isBrowser() {
7 | return isPlatformBrowser(this.platformId);
8 | }
9 | constructor(@Inject(PLATFORM_ID) private platformId: string) {}
10 | }
11 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/unauthorized/unauthorized.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-unauthorized',
5 | templateUrl: './unauthorized.component.html',
6 | styleUrls: ['./unauthorized.component.css']
7 | })
8 | export class UnauthorizedComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/unauthorized/unauthorized.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-unauthorized',
5 | templateUrl: './unauthorized.component.html',
6 | styleUrls: ['./unauthorized.component.css']
7 | })
8 | export class UnauthorizedComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Code Flow
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/validation/state-validation-result.ts:
--------------------------------------------------------------------------------
1 | import { ValidationResult } from './validation-result';
2 |
3 | export class StateValidationResult {
4 | constructor(
5 | public accessToken = '',
6 | public idToken = '',
7 | public authResponseIsValid = false,
8 | public decodedIdToken: any = {},
9 | public state: ValidationResult = ValidationResult.NotSet
10 | ) {}
11 | }
12 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/logging/logger.service-mock.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 |
3 | @Injectable()
4 | export class LoggerServiceMock {
5 | logError(message: any, ...args: any[]) {
6 | console.error(message, ...args);
7 | }
8 |
9 | logWarning(message: any) {
10 | console.warn(message);
11 | }
12 |
13 | logDebug(message: any) {
14 | console.log(message);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/api/data.service-mock.ts:
--------------------------------------------------------------------------------
1 | import { HttpHeaders } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { of } from 'rxjs';
4 |
5 | @Injectable()
6 | export class DataServiceMock {
7 | get(url: string, token?: string) {
8 | return of();
9 | }
10 |
11 | post(url: string, body: any, headersParams?: HttpHeaders) {
12 | return of();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/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.error(err));
13 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Code Flow HttpConfig
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Code Flow Refresh Tokens
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Implicit Flow Silent Renew
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/angular-auth-oidc-client",
4 | "lib": {
5 | "entryFile": "src/public-api.ts",
6 | "umdModuleIds": {
7 | "jsrsasign-reduced": "jsrsasign-reduced",
8 | "common-tags": "common-tags"
9 | }
10 | },
11 | "whitelistedNonPeerDependencies": ["jsrsasign-reduced", "common-tags"]
12 | }
13 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/flows/callback-context.ts:
--------------------------------------------------------------------------------
1 | import { JwtKeys } from '../validation/jwtkeys';
2 | import { StateValidationResult } from '../validation/state-validation-result';
3 | export interface CallbackContext {
4 | code: string;
5 | refreshToken: string;
6 | state: string;
7 | sessionState: string | null;
8 | authResult: any;
9 | isRenewProcess: boolean;
10 | jwtKeys: JwtKeys;
11 | validationResult: StateValidationResult;
12 | existingIdToken: any;
13 | }
14 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/forbidden/forbidden.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-forbidden',
5 | templateUrl: 'forbidden.component.html'
6 | })
7 |
8 | export class ForbiddenComponent implements OnInit {
9 |
10 | public message: string;
11 | public values: any[];
12 |
13 | constructor() {
14 | this.message = 'ForbiddenComponent constructor';
15 | }
16 |
17 | ngOnInit() {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/storage/browser-storage.service-mock.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { AbstractSecurityStorage } from '.';
3 |
4 | @Injectable()
5 | export class BrowserStorageMock implements AbstractSecurityStorage {
6 | store: { [key: string]: any } = {};
7 |
8 | read(key: string): any {
9 | return this.store[key];
10 | }
11 |
12 | write(key: string, value: any): void {
13 | value = !value ? null : value;
14 | this.store[key] = value;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/auto-login/auto-login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 |
4 | @Component({
5 | selector: 'app-auto-component',
6 | templateUrl: './auto-login.component.html',
7 | })
8 | export class AutoLoginComponent implements OnInit {
9 | constructor(public oidcSecurityService: OidcSecurityService) {}
10 |
11 | ngOnInit() {
12 | this.oidcSecurityService.authorize();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/unauthorized/unauthorized.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-unauthorized',
5 | templateUrl: 'unauthorized.component.html'
6 | })
7 |
8 | export class UnauthorizedComponent implements OnInit {
9 |
10 | public message: string;
11 | public values: any[];
12 |
13 | constructor() {
14 | this.message = 'UnauthorizedComponent constructor';
15 | }
16 |
17 | ngOnInit() {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/unauthorized/unauthorized.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-unauthorized',
5 | templateUrl: 'unauthorized.component.html'
6 | })
7 |
8 | export class UnauthorizedComponent implements OnInit {
9 |
10 | public message: string;
11 | public values: any[];
12 |
13 | constructor() {
14 | this.message = 'UnauthorizedComponent constructor';
15 | }
16 |
17 | ngOnInit() {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/lib",
5 | "target": "es2015",
6 | "declaration": true,
7 | "inlineSources": true,
8 | "types": ["node"],
9 | "lib": [
10 | "dom",
11 | "es2018"
12 | ]
13 | },
14 | "angularCompilerOptions": {
15 | "skipTemplateCodegen": true,
16 | "strictMetadataEmit": true,
17 | "enableResourceInlining": true
18 | },
19 | "exclude": [
20 | "src/test.ts",
21 | "**/*.spec.ts"
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/url/uri-encoder.ts:
--------------------------------------------------------------------------------
1 | import { HttpParameterCodec } from '@angular/common/http';
2 |
3 | export class UriEncoder implements HttpParameterCodec {
4 | encodeKey(key: string): string {
5 | return encodeURIComponent(key);
6 | }
7 |
8 | encodeValue(value: string): string {
9 | return encodeURIComponent(value);
10 | }
11 |
12 | decodeKey(key: string): string {
13 | return decodeURIComponent(key);
14 | }
15 |
16 | decodeValue(value: string): string {
17 | return decodeURIComponent(value);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Is Authenticated: {{ isAuthenticated }}
8 |
9 |
10 | userData
11 |
{{ userData$ | async | json }}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | You are NOT authenticated
20 |
21 |
22 | Configuration loaded:
23 | {{ configuration | json }}
24 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/auto-login/auto-login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 |
4 | @Component({
5 | selector: 'app-auto-component',
6 | templateUrl: './auto-login.component.html',
7 | })
8 | export class AutoLoginComponent implements OnInit {
9 | lang: any;
10 |
11 | constructor(public oidcSecurityService: OidcSecurityService) {}
12 |
13 | ngOnInit() {
14 | this.oidcSecurityService.checkAuth().subscribe(() => this.oidcSecurityService.authorize());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/auto-login/auto-login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 |
4 | @Component({
5 | selector: 'app-auto-component',
6 | templateUrl: './auto-login.component.html',
7 | })
8 | export class AutoLoginComponent implements OnInit {
9 | lang: any;
10 |
11 | constructor(public oidcSecurityService: OidcSecurityService) {}
12 |
13 | ngOnInit() {
14 | this.oidcSecurityService.checkAuth().subscribe(() => this.oidcSecurityService.authorize());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/auto-login/auto-login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 |
4 | @Component({
5 | selector: 'app-auto-component',
6 | templateUrl: './auto-login.component.html',
7 | })
8 | export class AutoLoginComponent implements OnInit {
9 | lang: any;
10 |
11 | constructor(public oidcSecurityService: OidcSecurityService) {}
12 |
13 | ngOnInit() {
14 | this.oidcSecurityService.checkAuth().subscribe(() => this.oidcSecurityService.authorize());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/api/http-base.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 |
5 | @Injectable()
6 | export class HttpBaseService {
7 | constructor(private http: HttpClient) {}
8 |
9 | get(url: string, params?: { [key: string]: any }): Observable {
10 | return this.http.get(url, params);
11 | }
12 |
13 | post(url: string, body: any, params?: { [key: string]: any }): Observable {
14 | return this.http.post(url, body, params);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/forbidden/forbidden.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-forbidden',
7 | templateUrl: 'forbidden.component.html',
8 | })
9 | export class ForbiddenComponent implements OnInit {
10 | public authenticated$: Observable;
11 |
12 | constructor(private oidcSecurityService: OidcSecurityService) {}
13 |
14 | ngOnInit() {
15 | this.authenticated$ = this.oidcSecurityService.isAuthenticated$;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/storage/abstract-security-storage.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 |
3 | /**
4 | * Implement this class-interface to create a custom storage.
5 | */
6 | @Injectable()
7 | export abstract class AbstractSecurityStorage {
8 | /**
9 | * This method must contain the logic to read the storage.
10 | * @return The value of the given key
11 | */
12 | public abstract read(key: string): any;
13 |
14 | /**
15 | * This method must contain the logic to write the storage.
16 | * @param value The value for the given key
17 | */
18 | public abstract write(key: string, value: any): void;
19 | }
20 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/public-events/public-events.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ReplaySubject } from 'rxjs';
3 | import { EventTypes } from './event-types';
4 | import { OidcClientNotification } from './notification';
5 |
6 | // TODO RENAME TO PUBLIC EVENTS SERVICE
7 | @Injectable()
8 | export class PublicEventsService {
9 | private notify = new ReplaySubject>(1);
10 |
11 | fireEvent(type: EventTypes, value?: T) {
12 | this.notify.next({ type, value });
13 | }
14 |
15 | registerForEvents() {
16 | return this.notify.asObservable();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Is Authenticated: {{ isAuthenticated }}
10 |
11 |
12 | userData
13 |
{{ userData$ | async | json }}
14 | {{ checkSessionChanged }}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Configuration loaded:
24 | {{ configuration | json }}
25 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Is Authenticated: {{ isAuthenticated }}
10 |
11 |
12 | userData
13 |
{{ userData$ | async | json }}
14 | {{ checkSessionChanged }}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Configuration loaded:
24 | {{ configuration | json }}
25 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-home',
7 | templateUrl: 'home.component.html',
8 | })
9 | export class HomeComponent implements OnInit {
10 | userData$: Observable;
11 | isAuthenticated$: Observable;
12 |
13 | constructor(public oidcSecurityService: OidcSecurityService) {}
14 |
15 | ngOnInit() {
16 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
17 | this.userData$ = this.oidcSecurityService.userData$;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-home',
7 | templateUrl: 'home.component.html',
8 | })
9 | export class HomeComponent implements OnInit {
10 | userData$: Observable;
11 | isAuthenticated$: Observable;
12 |
13 | constructor(public oidcSecurityService: OidcSecurityService) {}
14 |
15 | ngOnInit() {
16 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
17 | this.userData$ = this.oidcSecurityService.userData$;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-home',
7 | templateUrl: 'home.component.html',
8 | })
9 | export class HomeComponent implements OnInit {
10 | userData$: Observable;
11 | isAuthenticated$: Observable;
12 |
13 | constructor(public oidcSecurityService: OidcSecurityService) {}
14 |
15 | ngOnInit() {
16 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
17 | this.userData$ = this.oidcSecurityService.userData$;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-home',
7 | templateUrl: 'home.component.html',
8 | })
9 | export class HomeComponent implements OnInit {
10 | userData$: Observable;
11 | isAuthenticated$: Observable;
12 |
13 | constructor(public oidcSecurityService: OidcSecurityService) {}
14 |
15 | ngOnInit() {
16 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
17 | this.userData$ = this.oidcSecurityService.userData$;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/home/home.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { HomeComponent } from './home.component';
4 |
5 | describe('HomeComponent', () => {
6 | let component: HomeComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ HomeComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(HomeComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-code-flow app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
12 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "downlevelIteration": true,
9 | "experimentalDecorators": true,
10 | "module": "esnext",
11 | "moduleResolution": "node",
12 | "importHelpers": true,
13 | "target": "es2015",
14 | "lib": ["es2018", "dom"],
15 | "paths": {
16 | "angular-auth-oidc-client": ["dist/angular-auth-oidc-client/angular-auth-oidc-client", "dist/angular-auth-oidc-client"]
17 | }
18 | },
19 | "angularCompilerOptions": {
20 | "fullTemplateTypeCheck": true,
21 | "strictInjectionParameters": true
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/config/config.provider-mock.ts:
--------------------------------------------------------------------------------
1 | import { AuthWellKnownEndpoints } from './auth-well-known-endpoints';
2 | import { OpenIdConfiguration } from './openid-configuration';
3 | import { PublicConfiguration } from './public-configuration';
4 |
5 | export class ConfigurationProviderMock {
6 | get openIDConfiguration(): OpenIdConfiguration {
7 | return null;
8 | }
9 |
10 | get wellKnownEndpoints(): AuthWellKnownEndpoints {
11 | return null;
12 | }
13 |
14 | get configuration(): PublicConfiguration {
15 | return null;
16 | }
17 |
18 | hasValidConfig() {
19 | return true;
20 | }
21 |
22 | setConfig(configuration: OpenIdConfiguration, wellKnownEndpoints: AuthWellKnownEndpoints) {}
23 | }
24 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-code-flow-auto-login app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-code-flow-http-config app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-implicit-flow-ad-b2c app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-implicit-flow-azuread app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-implicit-flow-google app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: required
2 | dist: trusty
3 | addons:
4 | chrome: stable
5 | language: node_js
6 | node_js:
7 | - '12'
8 | before_install:
9 | - npm i npm@^6 -g
10 | - npm install -g @angular/cli
11 | install:
12 | - npm install
13 | script:
14 | - npm run lint-lib
15 | - npm run test-lib-ci
16 | - npm run build-lib
17 | - cd ../..
18 | - ls
19 | - ng new testProject
20 | - cd ./testProject
21 | - npm install ../damienbod/angular-auth-oidc-client/dist/angular-auth-oidc-client
22 | - npm test -- --watch=false --browsers=ChromeHeadless
23 | before_script:
24 | - export DISPLAY=:99.0
25 | - sh -e /etc/init.d/xvfb start
26 | - sleep 3
27 | notifications:
28 | email: false
29 | notifications:
30 | slack: damienandfabian:jBlE2pSSKe18mysZZh1vtPUM
31 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/app.routes.ts:
--------------------------------------------------------------------------------
1 | import { RouterModule, Routes } from '@angular/router';
2 | import { AutoLoginComponent } from './auto-login/auto-login.component';
3 | import { ForbiddenComponent } from './forbidden/forbidden.component';
4 | import { HomeComponent } from './home/home.component';
5 | import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
6 |
7 | const appRoutes: Routes = [
8 | { path: '', component: HomeComponent },
9 | { path: 'home', component: HomeComponent },
10 | { path: 'autologin', component: AutoLoginComponent },
11 | { path: 'forbidden', component: ForbiddenComponent },
12 | { path: 'unauthorized', component: UnauthorizedComponent },
13 | ];
14 |
15 | export const routing = RouterModule.forRoot(appRoutes);
16 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-code-flow-refresh-tokens app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Is Authenticated: {{ isAuthenticated }}
11 |
12 |
13 | userData
14 |
{{ userData$ | async | json }}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Configuration loaded:
25 | {{ configuration | json }}
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('sample-implicit-flow-silent-renew app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/forbidden/forbidden.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ForbiddenComponent } from './forbidden.component';
4 |
5 | describe('ForbiddenComponent', () => {
6 | let component: ForbiddenComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ForbiddenComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ForbiddenComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/protected/protected.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ProtectedComponent } from './protected.component';
4 |
5 | describe('ProtectedComponent', () => {
6 | let component: ProtectedComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ProtectedComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ProtectedComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/forbidden/forbidden.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ForbiddenComponent } from './forbidden.component';
4 |
5 | describe('ForbiddenComponent', () => {
6 | let component: ForbiddenComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ForbiddenComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ForbiddenComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/protected/protected.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ProtectedComponent } from './protected.component';
4 |
5 | describe('ProtectedComponent', () => {
6 | let component: ProtectedComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ProtectedComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ProtectedComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/forbidden/forbidden.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ForbiddenComponent } from './forbidden.component';
4 |
5 | describe('ForbiddenComponent', () => {
6 | let component: ForbiddenComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ForbiddenComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ForbiddenComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/protected/protected.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ProtectedComponent } from './protected.component';
4 |
5 | describe('ProtectedComponent', () => {
6 | let component: ProtectedComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ProtectedComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ProtectedComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/auto-login/auto-login.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AutoLoginComponent } from './auto-login.component';
4 |
5 | describe('AutoLoginComponent', () => {
6 | let component: AutoLoginComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AutoLoginComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AutoLoginComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/auto-login/auto-login.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AutoLoginComponent } from './auto-login.component';
4 |
5 | describe('AutoLoginComponent', () => {
6 | let component: AutoLoginComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AutoLoginComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AutoLoginComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/auto-login/auto-login.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AutoLoginComponent } from './auto-login.component';
4 |
5 | describe('AutoLoginComponent', () => {
6 | let component: AutoLoginComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AutoLoginComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AutoLoginComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/navigation/navigation.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { NavigationComponent } from './navigation.component';
4 |
5 | describe('NavigationComponent', () => {
6 | let component: NavigationComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ NavigationComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(NavigationComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/validation/validation-result.ts:
--------------------------------------------------------------------------------
1 | export enum ValidationResult {
2 | NotSet = 'NotSet',
3 | StatesDoNotMatch = 'StatesDoNotMatch',
4 | SignatureFailed = 'SignatureFailed',
5 | IncorrectNonce = 'IncorrectNonce',
6 | RequiredPropertyMissing = 'RequiredPropertyMissing',
7 | MaxOffsetExpired = 'MaxOffsetExpired',
8 | IssDoesNotMatchIssuer = 'IssDoesNotMatchIssuer',
9 | NoAuthWellKnownEndPoints = 'NoAuthWellKnownEndPoints',
10 | IncorrectAud = 'IncorrectAud',
11 | IncorrectIdTokenClaimsAfterRefresh = 'IncorrectIdTokenClaimsAfterRefresh',
12 | IncorrectAzp = 'IncorrectAzp',
13 | TokenExpired = 'TokenExpired',
14 | IncorrectAtHash = 'IncorrectAtHash',
15 | Ok = 'Ok',
16 | LoginRequired = 'LoginRequired',
17 | SecureTokenServerError = 'SecureTokenServerError',
18 | }
19 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/unauthorized/unauthorized.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { UnauthorizedComponent } from './unauthorized.component';
4 |
5 | describe('UnauthorizedComponent', () => {
6 | let component: UnauthorizedComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ UnauthorizedComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(UnauthorizedComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/unauthorized/unauthorized.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { UnauthorizedComponent } from './unauthorized.component';
4 |
5 | describe('UnauthorizedComponent', () => {
6 | let component: UnauthorizedComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ UnauthorizedComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(UnauthorizedComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/unauthorized/unauthorized.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { UnauthorizedComponent } from './unauthorized.component';
4 |
5 | describe('UnauthorizedComponent', () => {
6 | let component: UnauthorizedComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ UnauthorizedComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(UnauthorizedComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/docs/logout.md:
--------------------------------------------------------------------------------
1 | # Logoff
2 |
3 | The `logoff()` function sends an endsesion request to the OIDC server, if it is available, or the check session has not sent a changed event.
4 |
5 | ```typescript
6 | logout() {
7 | this.oidcSecurityService.logoff();
8 | }
9 |
10 | ```
11 |
12 | The `logoffAndRevokeTokens()` function revokes the access token and the refresh token if using a refresh flow, and then logoff like above.
13 |
14 | ```typescript
15 | logoffAndRevokeTokens() {
16 | this.oidcSecurityService.logoffAndRevokeTokens()
17 | .subscribe((result) => console.log(result));
18 | }
19 | ```
20 |
21 | The `logoffLocal()` function is used to reset you local session in the browser, but not sending anything to the server.
22 |
23 | ```typescript
24 | logoutLocal() {
25 | this.oidcSecurityService.logoffLocal();
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.codeActionsOnSave": {
3 | "source.organizeImports": true
4 | },
5 | "editor.formatOnSave": true,
6 | "editor.formatOnPaste": true,
7 | "editor.defaultFormatter": "esbenp.prettier-vscode",
8 | "[typescript]": {
9 | "editor.defaultFormatter": "esbenp.prettier-vscode"
10 | },
11 | "[json]": {
12 | "editor.defaultFormatter": "esbenp.prettier-vscode"
13 | },
14 | "[jsonc]": {
15 | "editor.defaultFormatter": "esbenp.prettier-vscode"
16 | },
17 | "[javascript]": {
18 | "editor.defaultFormatter": "esbenp.prettier-vscode"
19 | },
20 | "[html]": {
21 | "editor.defaultFormatter": "esbenp.prettier-vscode"
22 | },
23 | "[less]": {
24 | "editor.defaultFormatter": "esbenp.prettier-vscode"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events*.json
15 | speed-measure-plugin*.json
16 |
17 | # IDEs and editors
18 | /.idea
19 | .project
20 | .classpath
21 | .c9/
22 | *.launch
23 | .settings/
24 | *.sublime-workspace
25 |
26 | # IDE - VSCode
27 | .vscode/*
28 | !.vscode/settings.json
29 | !.vscode/tasks.json
30 | !.vscode/launch.json
31 | !.vscode/extensions.json
32 | .history/*
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
48 | /.angulardoc.json
49 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
12 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
12 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
12 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
12 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/silent-renew.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | silent-renew
8 |
9 |
10 |
11 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/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/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/angular-auth-oidc-client.ts:
--------------------------------------------------------------------------------
1 | // Public classes.
2 |
3 | export * from './auth.module';
4 | export * from './authState/authorization-result';
5 | export * from './authState/authorized-state';
6 | export * from './config/auth-well-known-endpoints';
7 | export * from './config/config.service';
8 | export * from './config/openid-configuration';
9 | export * from './config/public-configuration';
10 | export * from './logging/log-level';
11 | export * from './logging/logger.service';
12 | export * from './oidc.security.service';
13 | export * from './public-events';
14 | export * from './storage';
15 | export * from './utils/tokenHelper/oidc-token-helper.service';
16 | export * from './validation/jwtkeys';
17 | export * from './validation/state-validation-result';
18 | export * from './validation/token-validation.service';
19 | export * from './validation/validation-result';
20 |
--------------------------------------------------------------------------------
/certs/dev_localhost.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICQDCCAamgAwIBAgIJAIKGapdMCt4NMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNVBAMTCWxvY2Fs
3 | aG9zdDAeFw0yMDAyMjAyMjU3MjFaFw0zMDAyMjEyMjU3MjFaMBQxEjAQBgNVBAMTCWxvY2FsaG9z
4 | dDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArOxyNClqlxIx9X8V3ZIFR4PtVIG7QYcJHmd1
5 | oQbExnMJahlJs6pYSokdoU3fRnTIUJtbRXlPagDKZoJcUfl4KGaBL/bqF8P03noHSr59Vd3sU8Xl
6 | CyAxiTlyusENTPuBSzK+8wVpTIVpqnG2Exx1cMGHfsnA0R1NzQCMQ3zFEkECAwEAAaOBmTCBljAS
7 | BgNVHRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIB/jAUBgNVHREEDTALgglsb2NhbGhvc3Qw
8 | OwYDVR0lBDQwMgYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDAwYIKwYBBQUHAwQGCCsGAQUF
9 | BwMIMB0GA1UdDgQWBBQaVighscgq5k8BjEzeSsZp+6RxITANBgkqhkiG9w0BAQsFAAOBgQBXH/Sq
10 | jekwz+O0eG0zA2MA2LSwt7OELi54vATFYkXO45IO5frRagUTWDkx85/Vfm9OcdfoaHD1UzPkGBU0
11 | BPsnN3SGCB3Pk5jSRaXIBBiqByDFiP+G6EYmUYhLxB3FpJp6S5KlnQtdtLkl3KuT8KBtc9haro+e
12 | lDlUx5s/FM3SJw==
13 | -----END CERTIFICATE-----
14 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/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/zone';
4 | import 'zone.js/dist/zone-testing';
5 | import { getTestBed } from '@angular/core/testing';
6 | import {
7 | BrowserDynamicTestingModule,
8 | platformBrowserDynamicTesting
9 | } from '@angular/platform-browser-dynamic/testing';
10 |
11 | declare const require: {
12 | context(path: string, deep?: boolean, filter?: RegExp): {
13 | keys(): string[];
14 | (id: string): T;
15 | };
16 | };
17 |
18 | // First, initialize the Angular testing environment.
19 | getTestBed().initTestEnvironment(
20 | BrowserDynamicTestingModule,
21 | platformBrowserDynamicTesting()
22 | );
23 | // Then we find all the tests.
24 | const context = require.context('./', true, /\.spec\.ts$/);
25 | // And load the modules.
26 | context.keys().map(context);
27 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/navigation/navigation.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-navigation',
7 | templateUrl: 'navigation.component.html',
8 | })
9 | export class NavigationComponent implements OnInit {
10 | isAuthenticated$: Observable;
11 |
12 | constructor(public oidcSecurityService: OidcSecurityService) {}
13 |
14 | ngOnInit() {
15 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
16 | }
17 |
18 | login() {
19 | this.oidcSecurityService.authorize();
20 | }
21 |
22 | refreshSession() {
23 | this.oidcSecurityService.authorize();
24 | }
25 |
26 | logout() {
27 | this.oidcSecurityService.logoff();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/navigation/navigation.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-navigation',
7 | templateUrl: 'navigation.component.html',
8 | })
9 | export class NavigationComponent implements OnInit {
10 | isAuthenticated$: Observable;
11 |
12 | constructor(public oidcSecurityService: OidcSecurityService) {}
13 |
14 | ngOnInit() {
15 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
16 | }
17 |
18 | login() {
19 | this.oidcSecurityService.authorize();
20 | }
21 |
22 | refreshSession() {
23 | this.oidcSecurityService.authorize();
24 | }
25 |
26 | logout() {
27 | this.oidcSecurityService.logoff();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/certs/dev_localhost.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICXQIBAAKBgQCs7HI0KWqXEjH1fxXdkgVHg+1UgbtBhwkeZ3WhBsTGcwlqGUmzqlhKiR2hTd9G
3 | dMhQm1tFeU9qAMpmglxR+XgoZoEv9uoXw/TeegdKvn1V3exTxeULIDGJOXK6wQ1M+4FLMr7zBWlM
4 | hWmqcbYTHHVwwYd+ycDRHU3NAIxDfMUSQQIDAQABAoGAIB8z/7iJ0lJQ8XeQCj6ruGMrXP1UWZHK
5 | AdnaIfVt7CdGYm0cIcHM8NuTo3khtqbO5xpU1Az60YggEPa6S4f558kGBIg4PQVxgE/Kv77ptGAk
6 | rZG9FaCyIibGMh5aJLtxG0Fh1FGnuK1Xk1BKXtaGRUkZpKGg4rMJ9w3qp/T5vLkCQQDe+FiMqY2s
7 | pxHEz+h3NJ0H2T81FCx2upf1fjTVtlQnJ7Gds6eZT0zwa3z1bSw+VkxICERY8C43bzPUJUgPIyLX
8 | AkEAxooyVkJHmxlcIvZfrZPvQs+2GOXpWVnyjNUWf8t9G2MsmkdGIkp7oJhi5obpdNR+3jQe0xyr
9 | Dvy1hbHuGp5opwJBALO6Zc5EogGozgbiPBVSoL2B3ZRQhaLSt8jYCYi3JtBFC8P927wVkwQ88IX4
10 | kXBSKbzqhQVX3Tkr9xArWRFylhMCQFmigt9WxSVM6cAPI1smctrjE/9hrVxds5fJjILdx/nZaIWu
11 | sAdDQVVb9yrEthm85hpDxbbiNohppzpY/nqeEfkCQQDInS/pP5dYTUxFV+/YweK+6smN2v+dYZAi
12 | 5KShWRl5fwpl+mdJT3aziRb/kfYkhGPQMO06OnGzjNKt7Rg0Z8mD
13 | -----END RSA PRIVATE KEY-----
14 |
--------------------------------------------------------------------------------
/docs/authorizing-popup-iframe.md:
--------------------------------------------------------------------------------
1 | # Authorizing in a popup or iframe
2 |
3 | You can call the Provider's authorization endpoint in a popup or iframe instead of navigating to it in the app's parent window.
4 | This allows you to have the Provider's consent prompt display in a popup window to avoid unloading and reloading the app,
5 | or to authorize the user silently by loading the endpoint in a hidden iframe if that supported by the Provider.
6 |
7 | To get the fully-formed authorization URL, pass a handler function to `OidcSecurityService.authorize`
8 | (this will also prevent the default behavior of loading the authorization endpoint in the current window):
9 |
10 | ```typescript
11 | login() {
12 |
13 | const urlHandler = (authUrl) => {
14 | // handle the authorization URL
15 | window.open(authUrl, '_blank', 'toolbar=0,location=0,menubar=0');
16 | }
17 |
18 | this.oidcSecurityService.authorize({ urlhandler });
19 | }
20 | ```
21 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | browserName: 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/app.routes.ts:
--------------------------------------------------------------------------------
1 | import { RouterModule, Routes } from '@angular/router';
2 | import { AuthorizationGuard } from './authorization.guard';
3 | import { AutoLoginComponent } from './auto-login/auto-login.component';
4 | import { ForbiddenComponent } from './forbidden/forbidden.component';
5 | import { HomeComponent } from './home/home.component';
6 | import { ProtectedComponent } from './protected/protected.component';
7 | import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
8 |
9 | const appRoutes: Routes = [
10 | { path: '', pathMatch: 'full', redirectTo: 'home' },
11 | { path: 'home', component: HomeComponent },
12 | { path: 'autologin', component: AutoLoginComponent },
13 | { path: 'forbidden', component: ForbiddenComponent, canActivate: [AuthorizationGuard] },
14 | { path: 'unauthorized', component: UnauthorizedComponent },
15 | { path: 'protected', component: ProtectedComponent },
16 | ];
17 |
18 | export const routing = RouterModule.forRoot(appRoutes);
19 |
--------------------------------------------------------------------------------
/docs/csp-cors-config.md:
--------------------------------------------------------------------------------
1 | # X-Frame-Options / CSP ancestor / different domains
2 |
3 | If deploying the client application and the STS server application with 2 different domains,
4 | the X-Frame-Options HTTPS header needs to allow all iframes. Then use the CSP HTTPS header to only allow the required domains.
5 | **The silent renew requires this.**
6 |
7 | Add this header to responses from the server that serves your SPA:
8 |
9 | ```
10 | Content-Security-Policy: script-src 'self' 'unsafe-inline';style-src 'self' 'unsafe-inline';img-src 'self' data:;font-src 'self';frame-ancestors 'self' https://localhost:44318;block-all-mixed-content
11 | ```
12 |
13 | where `https://localhost:44318` is the address of your STS server.
14 |
15 | e.g. if you use NginX to serve your Angular application, it would be
16 |
17 | ```
18 | http {
19 | server {
20 | ...
21 | add_header Content-Security-Policy "script-src 'self' 'unsafe-inline';style-src 'self' 'unsafe-inline';img-src 'self' data:;font-src 'self';frame-ancestors 'self' https://localhost:44318;block-all-mixed-content";
22 | ```
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/app.routes.ts:
--------------------------------------------------------------------------------
1 | import { Routes, RouterModule } from '@angular/router';
2 |
3 | import { ForbiddenComponent } from './forbidden/forbidden.component';
4 | import { HomeComponent } from './home/home.component';
5 | import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
6 | import { AutoLoginComponent } from './auto-login/auto-login.component';
7 | import { ProtectedComponent } from './protected/protected.component';
8 | import { AuthorizationGuard } from './authorization.guard';
9 |
10 | const appRoutes: Routes = [
11 | { path: '', component: HomeComponent, pathMatch: 'full'},
12 | { path: 'home', component: HomeComponent, canActivate: [AuthorizationGuard] },
13 | { path: 'autologin', component: AutoLoginComponent },
14 | { path: 'forbidden', component: ForbiddenComponent },
15 | { path: 'unauthorized', component: UnauthorizedComponent },
16 | { path: 'protected', component: ProtectedComponent, canActivate: [AuthorizationGuard] }
17 | ];
18 |
19 | export const routing = RouterModule.forRoot(appRoutes);
20 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/app.routes.ts:
--------------------------------------------------------------------------------
1 | import { Routes, RouterModule } from '@angular/router';
2 |
3 | import { ForbiddenComponent } from './forbidden/forbidden.component';
4 | import { HomeComponent } from './home/home.component';
5 | import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
6 | import { AutoLoginComponent } from './auto-login/auto-login.component';
7 | import { ProtectedComponent } from './protected/protected.component';
8 | import { AuthorizationGuard } from './authorization.guard';
9 |
10 | const appRoutes: Routes = [
11 | { path: '', component: HomeComponent, pathMatch: 'full'},
12 | { path: 'home', component: HomeComponent, canActivate: [AuthorizationGuard] },
13 | { path: 'autologin', component: AutoLoginComponent },
14 | { path: 'forbidden', component: ForbiddenComponent },
15 | { path: 'unauthorized', component: UnauthorizedComponent },
16 | { path: 'protected', component: ProtectedComponent, canActivate: [AuthorizationGuard] }
17 | ];
18 |
19 | export const routing = RouterModule.forRoot(appRoutes);
20 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 damienbod
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'testSts'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('testSts');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to testSts!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/logging/logger.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ConfigurationProvider } from '../config/config.provider';
3 | import { LogLevel } from './log-level';
4 |
5 | @Injectable()
6 | export class LoggerService {
7 | constructor(private configurationProvider: ConfigurationProvider) {}
8 |
9 | logError(message: any, ...args: any[]) {
10 | args.length ? console.error(message, args) : console.error(message);
11 | }
12 |
13 | logWarning(message: any, ...args: string[]) {
14 | if (this.currentLogLevelIsEqualOrSmallerThan(LogLevel.Warn)) {
15 | args.length ? console.warn(message, args) : console.warn(message);
16 | }
17 | }
18 |
19 | logDebug(message: any, ...args: string[]) {
20 | if (this.currentLogLevelIsEqualOrSmallerThan(LogLevel.Debug)) {
21 | args.length ? console.log(message, args) : console.log(message);
22 | }
23 | }
24 |
25 | private currentLogLevelIsEqualOrSmallerThan(logLevel: LogLevel) {
26 | return this.configurationProvider.openIDConfiguration.logLevel <= logLevel;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/authorization.guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
3 | import { OidcSecurityService } from 'angular-auth-oidc-client';
4 | import { Observable } from 'rxjs';
5 | import { map } from 'rxjs/operators';
6 |
7 | @Injectable({ providedIn: 'root' })
8 | export class AuthorizationGuard implements CanActivate {
9 | constructor(private oidcSecurityService: OidcSecurityService, private router: Router) {}
10 |
11 | canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
12 | return this.oidcSecurityService.isAuthenticated$.pipe(
13 | map((isAuthorized: boolean) => {
14 | console.log('AuthorizationGuard, canActivate isAuthorized: ' + isAuthorized);
15 |
16 | if (!isAuthorized) {
17 | this.router.navigate(['/unauthorized']);
18 | return false;
19 | }
20 |
21 | return true;
22 | })
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/authorization.guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
3 | import { OidcSecurityService } from 'angular-auth-oidc-client';
4 | import { Observable } from 'rxjs';
5 | import { map } from 'rxjs/operators';
6 |
7 | @Injectable({ providedIn: 'root' })
8 | export class AuthorizationGuard implements CanActivate {
9 | constructor(private oidcSecurityService: OidcSecurityService, private router: Router) {}
10 |
11 | canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
12 | return this.oidcSecurityService.isAuthenticated$.pipe(
13 | map((isAuthorized: boolean) => {
14 | console.log('AuthorizationGuard, canActivate isAuthorized: ' + isAuthorized);
15 |
16 | if (!isAuthorized) {
17 | this.router.navigate(['/unauthorized']);
18 | return false;
19 | }
20 |
21 | return true;
22 | })
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'testSts'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('testSts');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to testSts!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'testSts'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('testSts');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to testSts!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/nav-menu/nav-menu.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-nav-menu',
7 | templateUrl: './nav-menu.component.html',
8 | styleUrls: ['./nav-menu.component.css'],
9 | })
10 | export class NavMenuComponent implements OnInit {
11 | isExpanded = false;
12 | isAuthenticated$: Observable;
13 |
14 | constructor(public oidcSecurityService: OidcSecurityService) {}
15 |
16 | ngOnInit() {
17 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
18 | }
19 |
20 | login() {
21 | this.oidcSecurityService.authorize();
22 | }
23 |
24 | refreshSession() {
25 | this.oidcSecurityService.authorize();
26 | }
27 |
28 | logout() {
29 | this.oidcSecurityService.logoff();
30 | }
31 | collapse() {
32 | this.isExpanded = false;
33 | }
34 |
35 | toggle() {
36 | this.isExpanded = !this.isExpanded;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/nav-menu/nav-menu.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcSecurityService } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-nav-menu',
7 | templateUrl: './nav-menu.component.html',
8 | styleUrls: ['./nav-menu.component.css'],
9 | })
10 | export class NavMenuComponent implements OnInit {
11 | isExpanded = false;
12 | isAuthenticated$: Observable;
13 |
14 | constructor(public oidcSecurityService: OidcSecurityService) {}
15 |
16 | ngOnInit() {
17 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
18 | }
19 |
20 | login() {
21 | this.oidcSecurityService.authorize();
22 | }
23 |
24 | refreshSession() {
25 | this.oidcSecurityService.authorize();
26 | }
27 |
28 | logout() {
29 | this.oidcSecurityService.logoff();
30 | }
31 | collapse() {
32 | this.isExpanded = false;
33 | }
34 |
35 | toggle() {
36 | this.isExpanded = !this.isExpanded;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'testSts'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('testSts');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to testSts!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/api/data.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpHeaders } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 | import { HttpBaseService } from './http-base.service';
5 |
6 | @Injectable()
7 | export class DataService {
8 | constructor(private httpClient: HttpBaseService) {}
9 |
10 | get(url: string, token?: string): Observable {
11 | const headers = this.prepareHeaders(token);
12 |
13 | return this.httpClient.get(url, {
14 | headers,
15 | });
16 | }
17 |
18 | post(url: string, body: any, headersParams?: HttpHeaders) {
19 | const headers = headersParams || this.prepareHeaders();
20 |
21 | return this.httpClient.post(url, body, { headers });
22 | }
23 |
24 | private prepareHeaders(token?: string) {
25 | let headers = new HttpHeaders();
26 | headers = headers.set('Accept', 'application/json');
27 |
28 | if (!!token) {
29 | headers = headers.set('Authorization', 'Bearer ' + decodeURIComponent(token));
30 | }
31 |
32 | return headers;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/config/openid-configuration.ts:
--------------------------------------------------------------------------------
1 | import { LogLevel } from '../logging/log-level';
2 |
3 | export interface OpenIdConfiguration {
4 | stsServer?: string;
5 | authWellknownEndpoint?: string;
6 | redirectUrl?: string;
7 | clientId?: string;
8 | responseType?: string;
9 | scope?: string;
10 | hdParam?: string;
11 | postLogoutRedirectUri?: string;
12 | startCheckSession?: boolean;
13 | silentRenew?: boolean;
14 | silentRenewUrl?: string;
15 | renewTimeBeforeTokenExpiresInSeconds?: number;
16 | useRefreshToken?: boolean;
17 | ignoreNonceAfterRefresh?: boolean;
18 | postLoginRoute?: string;
19 | forbiddenRoute?: string;
20 | unauthorizedRoute?: string;
21 | autoUserinfo?: boolean;
22 | autoCleanStateAfterAuthentication?: boolean;
23 | triggerAuthorizationResultEvent?: boolean;
24 | logLevel?: LogLevel;
25 | issValidationOff?: boolean;
26 | historyCleanupOff?: boolean;
27 | maxIdTokenIatOffsetAllowedInSeconds?: number;
28 | disableIatOffsetValidation?: boolean;
29 | storage?: any;
30 | customParams?: { [key: string]: string | number | boolean };
31 | }
32 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-code-flow'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/iframe/silent-renew.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ConfigurationProvider } from '../config/config.provider';
3 | import { IFrameService } from './existing-iframe.service';
4 |
5 | const IFRAME_FOR_SILENT_RENEW_IDENTIFIER = 'myiFrameForSilentRenew';
6 |
7 | @Injectable()
8 | export class SilentRenewService {
9 | constructor(private configurationProvider: ConfigurationProvider, private iFrameService: IFrameService) {}
10 |
11 | getOrCreateIframe(): HTMLIFrameElement {
12 | const existingIframe = this.getExistingIframe();
13 |
14 | if (!existingIframe) {
15 | return this.iFrameService.addIFrameToWindowBody(IFRAME_FOR_SILENT_RENEW_IDENTIFIER);
16 | }
17 |
18 | return existingIframe;
19 | }
20 |
21 | isSilentRenewConfigured() {
22 | return (
23 | !this.configurationProvider.openIDConfiguration.useRefreshToken && this.configurationProvider.openIDConfiguration.silentRenew
24 | );
25 | }
26 |
27 | private getExistingIframe() {
28 | return this.iFrameService.getExistingIFrame(IFRAME_FOR_SILENT_RENEW_IDENTIFIER);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/angular-auth-oidc-client'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-code-flow-auto-login'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-http-config/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-code-flow-http-config'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-implicit-flow-ad-b2c'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-implicit-flow-azuread'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-implicit-flow-google'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'sample-code-flow-auto-login'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('sample-code-flow-auto-login');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to sample-code-flow-auto-login!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/authorization.guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
3 | import { OidcSecurityService } from 'angular-auth-oidc-client';
4 | import { Observable } from 'rxjs';
5 | import { map } from 'rxjs/operators';
6 |
7 | @Injectable({ providedIn: 'root' })
8 | export class AuthorizationGuard implements CanActivate {
9 | constructor(private oidcSecurityService: OidcSecurityService, private router: Router) {}
10 |
11 | canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
12 | // return checkAuth() again should be possible
13 | return this.oidcSecurityService.isAuthenticated$.pipe(
14 | map((isAuthorized: boolean) => {
15 | console.log('AuthorizationGuard, canActivate isAuthorized: ' + isAuthorized);
16 |
17 | if (!isAuthorized) {
18 | this.router.navigate(['/unauthorized']);
19 | return false;
20 | }
21 |
22 | return true;
23 | })
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-code-flow-refresh-tokens'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/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-devkit/build-angular'],
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-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../coverage/sample-implicit-flow-silent-renew'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/app/navigation/navigation.component.html:
--------------------------------------------------------------------------------
1 |
25 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular-auth-oidc-client",
3 | "author": "Damien Bowden & Fabian Gosebrink",
4 | "peerDependencies": {
5 | "rxjs": ">= 6.0.0",
6 | "@angular/core": ">= 8.0.0",
7 | "@angular/common": ">= 8.0.0",
8 | "@angular/router": ">= 8.0.0"
9 | },
10 | "dependencies": {
11 | "common-tags": "^1.8.0",
12 | "jsrsasign-reduced": "^8.0.15"
13 | },
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/damienbod/angular-auth-oidc-client.git"
17 | },
18 | "bugs": {
19 | "url": "https://github.com/damienbod/angular-auth-oidc-client/issues"
20 | },
21 | "homepage": "https://github.com/damienbod/angular-auth-oidc-client",
22 | "keywords": [
23 | "angular",
24 | "oidc",
25 | "oauth2",
26 | "openid",
27 | "security",
28 | "typescript",
29 | "openidconnect",
30 | "auth",
31 | "authn",
32 | "authentication",
33 | "identity",
34 | "certified",
35 | "oauth",
36 | "authorization"
37 | ],
38 | "license": "MIT",
39 | "version": "11.0.0",
40 | "description": "An OpenID Connect Code Flow with PKCE,Implicit Flow client for Angular"
41 | }
42 |
--------------------------------------------------------------------------------
/projects/sample-code-flow/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnDestroy, OnInit } from '@angular/core';
2 | import { OidcClientNotification, OidcSecurityService, PublicConfiguration } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-root',
7 | templateUrl: 'app.component.html',
8 | })
9 | export class AppComponent implements OnInit, OnDestroy {
10 | configuration: PublicConfiguration;
11 | userDataChanged$: Observable>;
12 | userData$: Observable;
13 | isAuthenticated$: Observable;
14 |
15 | constructor(public oidcSecurityService: OidcSecurityService) {}
16 |
17 | ngOnInit() {
18 | this.configuration = this.oidcSecurityService.configuration;
19 | this.userData$ = this.oidcSecurityService.userData$;
20 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
21 | this.oidcSecurityService.checkAuth().subscribe((isAuthenticated) => console.log('app authenticated', isAuthenticated));
22 | }
23 |
24 | ngOnDestroy(): void {}
25 |
26 | login() {
27 | this.oidcSecurityService.authorize();
28 | }
29 |
30 | logout() {
31 | this.oidcSecurityService.logoff();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | }));
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'sample-implicit-flow-google'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.componentInstance;
26 | expect(app.title).toEqual('sample-implicit-flow-google');
27 | });
28 |
29 | it('should render title', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.nativeElement;
33 | expect(compiled.querySelector('.content span').textContent).toContain('sample-implicit-flow-google app is running!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/config/default-config.ts:
--------------------------------------------------------------------------------
1 | import { LogLevel } from '../logging/log-level';
2 | import { OpenIdConfiguration } from './openid-configuration';
3 |
4 | export const DEFAULT_CONFIG: OpenIdConfiguration = {
5 | stsServer: 'https://please_set',
6 | authWellknownEndpoint: '',
7 | redirectUrl: 'https://please_set',
8 | clientId: 'please_set',
9 | responseType: 'code',
10 | scope: 'openid email profile',
11 | hdParam: '',
12 | postLogoutRedirectUri: 'https://please_set',
13 | startCheckSession: false,
14 | silentRenew: false,
15 | silentRenewUrl: 'https://please_set',
16 | renewTimeBeforeTokenExpiresInSeconds: 0,
17 | useRefreshToken: false,
18 | ignoreNonceAfterRefresh: false,
19 | postLoginRoute: '/',
20 | forbiddenRoute: '/forbidden',
21 | unauthorizedRoute: '/unauthorized',
22 | autoUserinfo: true,
23 | autoCleanStateAfterAuthentication: true,
24 | triggerAuthorizationResultEvent: false,
25 | logLevel: LogLevel.Warn,
26 | issValidationOff: false,
27 | historyCleanupOff: false,
28 | maxIdTokenIatOffsetAllowedInSeconds: 120,
29 | disableIatOffsetValidation: false,
30 | storage: typeof Storage !== 'undefined' ? sessionStorage : null,
31 | customParams: {},
32 | };
33 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/platform-provider/platform-provider.spec.ts:
--------------------------------------------------------------------------------
1 | import { PLATFORM_ID } from '@angular/core';
2 | import { TestBed } from '@angular/core/testing';
3 | import { PlatformProvider } from './platform.provider';
4 |
5 | describe('PlatformProvider Tests', () => {
6 | it('should create', () => {
7 | TestBed.configureTestingModule({
8 | providers: [PlatformProvider, { provide: PLATFORM_ID, useValue: 'browser' }],
9 | });
10 |
11 | const service = TestBed.inject(PlatformProvider);
12 | expect(service).toBeTruthy();
13 | });
14 |
15 | it('isBrowser equals true if "isPlatformBrowser" is true', () => {
16 | TestBed.configureTestingModule({
17 | providers: [PlatformProvider, { provide: PLATFORM_ID, useValue: 'browser' }],
18 | });
19 |
20 | const service = TestBed.inject(PlatformProvider);
21 | expect(service.isBrowser).toBe(true);
22 | });
23 |
24 | it('isBrowser equals true if "isPlatformBrowser" is true', () => {
25 | TestBed.configureTestingModule({
26 | providers: [PlatformProvider, { provide: PLATFORM_ID, useValue: 'notABrowser' }],
27 | });
28 |
29 | const service = TestBed.inject(PlatformProvider);
30 | expect(service.isBrowser).toBe(false);
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/app/navigation/navigation.component.html:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
33 |
34 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/nav-menu/nav-menu.component.html:
--------------------------------------------------------------------------------
1 |
30 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/nav-menu/nav-menu.component.html:
--------------------------------------------------------------------------------
1 |
30 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/flowHelper/flow-helper.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { ConfigurationProvider } from '../../config';
3 |
4 | // TODO TESTING
5 | @Injectable()
6 | export class FlowHelper {
7 | constructor(private configurationProvider: ConfigurationProvider) {}
8 |
9 | isCurrentFlowCodeFlow() {
10 | return this.currentFlowIs('code');
11 | }
12 |
13 | isCurrentFlowAnyImplicitFlow() {
14 | return this.isCurrentFlowImplicitFlowWithAccessToken() || this.isCurrentFlowImplicitFlowWithoutAccessToken();
15 | }
16 |
17 | isCurrentFlowCodeFlowWithRefeshTokens() {
18 | if (this.isCurrentFlowCodeFlow() && this.configurationProvider.openIDConfiguration.useRefreshToken) {
19 | return true;
20 | }
21 |
22 | return false;
23 | }
24 |
25 | isCurrentFlowImplicitFlowWithAccessToken() {
26 | return this.currentFlowIs('id_token token');
27 | }
28 |
29 | isCurrentFlowImplicitFlowWithoutAccessToken() {
30 | return this.currentFlowIs('id_token');
31 | }
32 |
33 | currentFlowIs(flowTypes: string[] | string) {
34 | const currentFlow = this.configurationProvider.openIDConfiguration.responseType;
35 |
36 | if (Array.isArray(flowTypes)) {
37 | return flowTypes.some((x) => currentFlow === x);
38 | }
39 |
40 | return currentFlow === flowTypes;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/utils/redirect/redirect.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 | import { WINDOW } from '../window/window.reference';
3 | import { RedirectService } from './redirect.service';
4 |
5 | describe('Redirect Service Tests', () => {
6 | let service: RedirectService;
7 | let mywindow: any;
8 |
9 | beforeEach(() => {
10 | TestBed.configureTestingModule({
11 | providers: [
12 | RedirectService,
13 | {
14 | provide: WINDOW,
15 | useValue: {
16 | location: {
17 | get href() {
18 | return 'fakeUrl';
19 | },
20 | set href(v) {},
21 | },
22 | },
23 | },
24 | ],
25 | });
26 |
27 | mywindow = TestBed.inject(WINDOW);
28 | });
29 |
30 | beforeEach(() => {
31 | service = TestBed.inject(RedirectService);
32 | });
33 |
34 | it('should create', () => {
35 | expect(service).toBeTruthy();
36 | expect(mywindow).toBeTruthy();
37 | });
38 |
39 | it('redirectTo sets window location href', () => {
40 | const spy = spyOnProperty(mywindow.location, 'href', 'set');
41 | service.redirectTo('anyurl');
42 | expect(spy).toHaveBeenCalledWith('anyurl');
43 | });
44 | });
45 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-auto-login/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Code Flow Auto Login
6 |
7 |
8 |
14 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-google/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SampleImplicitFlowGoogle
6 |
7 |
8 |
14 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/app/nav-menu/nav-menu.component.css:
--------------------------------------------------------------------------------
1 | li .glyphicon {
2 | margin-right: 10px;
3 | }
4 |
5 | /* Highlighting rules for nav menu items */
6 | li.link-active a,
7 | li.link-active a:hover,
8 | li.link-active a:focus {
9 | background-color: #4189C7;
10 | color: white;
11 | }
12 |
13 | /* Keep the nav menu independent of scrolling and on top of other items */
14 | .main-nav {
15 | position: fixed;
16 | top: 0;
17 | left: 0;
18 | right: 0;
19 | z-index: 1;
20 | }
21 |
22 | @media (min-width: 768px) {
23 | /* On small screens, convert the nav menu to a vertical sidebar */
24 | .main-nav {
25 | height: 100%;
26 | width: calc(25% - 20px);
27 | }
28 | .navbar {
29 | border-radius: 0px;
30 | border-width: 0px;
31 | height: 100%;
32 | }
33 | .navbar-header {
34 | float: none;
35 | }
36 | .navbar-collapse {
37 | border-top: 1px solid #444;
38 | padding: 0px;
39 | }
40 | .navbar ul {
41 | float: none;
42 | }
43 | .navbar li {
44 | float: none;
45 | font-size: 15px;
46 | margin: 6px;
47 | }
48 | .navbar li a {
49 | padding: 10px 16px;
50 | border-radius: 4px;
51 | }
52 | .navbar a {
53 | /* If a menu item's text is too long, truncate it */
54 | width: 100%;
55 | white-space: nowrap;
56 | overflow: hidden;
57 | text-overflow: ellipsis;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-ad-b2c/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Implicit Flow Azure B2C
6 |
7 |
8 |
14 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/app/nav-menu/nav-menu.component.css:
--------------------------------------------------------------------------------
1 | li .glyphicon {
2 | margin-right: 10px;
3 | }
4 |
5 | /* Highlighting rules for nav menu items */
6 | li.link-active a,
7 | li.link-active a:hover,
8 | li.link-active a:focus {
9 | background-color: #4189C7;
10 | color: white;
11 | }
12 |
13 | /* Keep the nav menu independent of scrolling and on top of other items */
14 | .main-nav {
15 | position: fixed;
16 | top: 0;
17 | left: 0;
18 | right: 0;
19 | z-index: 1;
20 | }
21 |
22 | @media (min-width: 768px) {
23 | /* On small screens, convert the nav menu to a vertical sidebar */
24 | .main-nav {
25 | height: 100%;
26 | width: calc(25% - 20px);
27 | }
28 | .navbar {
29 | border-radius: 0px;
30 | border-width: 0px;
31 | height: 100%;
32 | }
33 | .navbar-header {
34 | float: none;
35 | }
36 | .navbar-collapse {
37 | border-top: 1px solid #444;
38 | padding: 0px;
39 | }
40 | .navbar ul {
41 | float: none;
42 | }
43 | .navbar li {
44 | float: none;
45 | font-size: 15px;
46 | margin: 6px;
47 | }
48 | .navbar li a {
49 | padding: 10px 16px;
50 | border-radius: 4px;
51 | }
52 | .navbar a {
53 | /* If a menu item's text is too long, truncate it */
54 | width: 100%;
55 | white-space: nowrap;
56 | overflow: hidden;
57 | text-overflow: ellipsis;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-azuread/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sample Implicit Flow Azure AD
6 |
7 |
8 |
14 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/guards.md:
--------------------------------------------------------------------------------
1 | # Using Guards
2 |
3 | ```typescript
4 | import { Injectable } from '@angular/core';
5 | import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
6 | import { OidcSecurityService } from 'angular-auth-oidc-client';
7 | import { Observable } from 'rxjs';
8 | import { map } from 'rxjs/operators';
9 |
10 | @Injectable({ providedIn: 'root' })
11 | export class AuthorizationGuard implements CanActivate {
12 | constructor(private oidcSecurityService: OidcSecurityService, private router: Router) {}
13 |
14 | canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {
15 | // return checkAuth() again should be possible
16 | return this.oidcSecurityService.isAuthenticated$.pipe(
17 | map((isAuthorized: boolean) => {
18 | console.log('AuthorizationGuard, canActivate isAuthorized: ' + isAuthorized);
19 |
20 | if (!isAuthorized) {
21 | this.router.navigate(['/unauthorized']);
22 | return false;
23 | }
24 |
25 | return true;
26 | })
27 | );
28 | }
29 | }
30 | ```
31 |
32 | Do not forget to add the guard to your routes with `canActivate`, `canLoad`, etc.
33 |
34 | ```typescript
35 | const appRoutes: Routes = [
36 | // ...
37 | { path: 'protected', component: , canActivate: [AuthorizationGuard] }
38 | ];
39 | ```
40 |
41 | > The guard should only be applied to protected URLs. The guard should not be active on the default route, where the authorization request is processed.
42 |
--------------------------------------------------------------------------------
/projects/sample-implicit-flow-silent-renew/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcClientNotification, OidcSecurityService, PublicConfiguration } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-root',
7 | templateUrl: 'app.component.html',
8 | })
9 | export class AppComponent implements OnInit {
10 | configuration: PublicConfiguration;
11 | userDataChanged$: Observable>;
12 | userData$: Observable;
13 | isAuthenticated$: Observable;
14 | checkSessionChanged$: Observable;
15 | checkSessionChanged: any;
16 |
17 | constructor(public oidcSecurityService: OidcSecurityService) {}
18 | ngOnInit() {
19 | this.configuration = this.oidcSecurityService.configuration;
20 | this.userData$ = this.oidcSecurityService.userData$;
21 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
22 | this.checkSessionChanged$ = this.oidcSecurityService.checkSessionChanged$;
23 |
24 | this.oidcSecurityService.checkAuth().subscribe((isAuthenticated) => console.log('app authenticated', isAuthenticated));
25 | }
26 | login() {
27 | console.log('start login');
28 | this.oidcSecurityService.authorize();
29 | }
30 |
31 | refreshSession() {
32 | console.log('start refreshSession');
33 | this.oidcSecurityService.authorize();
34 | }
35 |
36 | logout() {
37 | console.log('start logoff');
38 | this.oidcSecurityService.logoff();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/projects/angular-auth-oidc-client/src/lib/flows/random/random.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { LoggerService } from '../../logging/logger.service';
3 |
4 | @Injectable()
5 | export class RandomService {
6 | constructor(private loggerService: LoggerService) {}
7 |
8 | createRandom(requiredLength: number): string {
9 | if (requiredLength <= 0) {
10 | return '';
11 | }
12 |
13 | if (requiredLength > 0 && requiredLength < 7) {
14 | this.loggerService.logWarning(`RandomService called with ${requiredLength} but 7 chars is the minimum, returning 10 chars`);
15 | requiredLength = 10;
16 | }
17 |
18 | const length = requiredLength - 6;
19 | const arr = new Uint8Array((length || length) / 2);
20 | this.getCrypto().getRandomValues(arr);
21 | return Array.from(arr, this.toHex).join('') + this.randomString(7);
22 | }
23 |
24 | private toHex(dec) {
25 | return ('0' + dec.toString(16)).substr(-2);
26 | }
27 |
28 | private randomString(length) {
29 | let result = '';
30 | const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
31 |
32 | const values = new Uint32Array(length);
33 | this.getCrypto().getRandomValues(values);
34 | for (let i = 0; i < length; i++) {
35 | result += characters[values[i] % characters.length];
36 | }
37 |
38 | return result;
39 | }
40 | private getCrypto() {
41 | // support for IE, (window.crypto || window.msCrypto)
42 | return window.crypto || (window as any).msCrypto;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/projects/sample-code-flow-refresh-tokens/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { OidcClientNotification, OidcSecurityService, PublicConfiguration } from 'angular-auth-oidc-client';
3 | import { Observable } from 'rxjs';
4 |
5 | @Component({
6 | selector: 'app-root',
7 | templateUrl: 'app.component.html',
8 | })
9 | export class AppComponent implements OnInit {
10 | configuration: PublicConfiguration;
11 | userDataChanged$: Observable>;
12 | userData$: Observable;
13 | isAuthenticated$: Observable;
14 | constructor(public oidcSecurityService: OidcSecurityService) {}
15 |
16 | ngOnInit() {
17 | this.configuration = this.oidcSecurityService.configuration;
18 | this.userData$ = this.oidcSecurityService.userData$;
19 | this.isAuthenticated$ = this.oidcSecurityService.isAuthenticated$;
20 |
21 | this.oidcSecurityService.checkAuth().subscribe((isAuthenticated) => console.log('app authenticated', isAuthenticated));
22 | }
23 |
24 | login() {
25 | this.oidcSecurityService.authorize();
26 | }
27 |
28 | logout() {
29 | this.oidcSecurityService.logoff();
30 | }
31 |
32 | logoffAndRevokeTokens() {
33 | this.oidcSecurityService.logoffAndRevokeTokens().subscribe((result) => console.log(result));
34 | }
35 |
36 | revokeRefreshToken() {
37 | this.oidcSecurityService.revokeRefreshToken().subscribe((result) => console.log(result));
38 | }
39 |
40 | revokeAccessToken() {
41 | this.oidcSecurityService.revokeAccessToken().subscribe((result) => console.log(result));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------