├── Angular ├── src │ ├── assets │ │ └── .gitkeep │ ├── favicon.ico │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── silent-refresh.html │ ├── app │ │ ├── shared │ │ │ ├── shared.module.ts │ │ │ └── api.service.ts │ │ ├── fallback.component.ts │ │ ├── feature-basics │ │ │ ├── public.component.ts │ │ │ ├── home.component.ts │ │ │ ├── admin1.component.ts │ │ │ └── basics.module.ts │ │ ├── sso │ │ │ ├── auth-module-config.ts │ │ │ ├── auth-config.ts │ │ │ ├── auth-guard.service.ts │ │ │ ├── auth-guard-with-forced-login.service.ts │ │ │ └── sso.module.ts │ │ ├── should-login.component.ts │ │ ├── feature-extras │ │ │ ├── admin2.component.ts │ │ │ └── extras.module.ts │ │ ├── app.module.ts │ │ ├── app-menu.component.ts │ │ └── app.component.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ ├── tslint.json │ ├── browserslist │ ├── main.ts │ ├── styles.css │ ├── index.html │ ├── test.ts │ ├── karma.conf.js │ └── polyfills.ts ├── screenshot-001.png ├── e2e │ ├── src │ │ ├── app.po.ts │ │ └── app.e2e-spec.ts │ ├── tsconfig.e2e.json │ └── protractor.conf.js ├── .editorconfig ├── tsconfig.json ├── .gitignore ├── LICENSE ├── package.json ├── README.md ├── tslint.json └── angular.json ├── AngularOIDC ├── src │ ├── assets │ │ ├── .gitkeep │ │ ├── favicon.ico │ │ └── img │ │ │ ├── avatars │ │ │ ├── 1.jpg │ │ │ ├── 2.jpg │ │ │ ├── 3.jpg │ │ │ ├── 4.jpg │ │ │ ├── 5.jpg │ │ │ ├── 6.jpg │ │ │ ├── 7.jpg │ │ │ └── 8.jpg │ │ │ └── brand │ │ │ ├── sygnet.svg │ │ │ └── logo.svg │ ├── app │ │ ├── app.component.css │ │ ├── views │ │ │ ├── cotacao │ │ │ │ ├── cotacao.component.scss │ │ │ │ ├── cotacao.module.ts │ │ │ │ ├── cotacao.component.ts │ │ │ │ ├── cotacao.service.ts │ │ │ │ └── cotacao.component.html │ │ │ ├── error │ │ │ │ ├── 404.component.ts │ │ │ │ ├── 500.component.ts │ │ │ │ ├── 404.component.html │ │ │ │ └── 500.component.html │ │ │ ├── base │ │ │ │ ├── cards.component.ts │ │ │ │ ├── tabs.component.ts │ │ │ │ ├── tables.component.ts │ │ │ │ ├── switches.component.ts │ │ │ │ ├── collapses.component.ts │ │ │ │ ├── tooltips.component.ts │ │ │ │ ├── popovers.component.ts │ │ │ │ ├── forms.component.ts │ │ │ │ ├── paginations.component.ts │ │ │ │ ├── carousels.component.ts │ │ │ │ ├── collapses.component.html │ │ │ │ ├── progress.component.ts │ │ │ │ ├── base.module.ts │ │ │ │ ├── progress.component.html │ │ │ │ ├── base-routing.module.ts │ │ │ │ ├── paginations.component.html │ │ │ │ ├── tooltips.component.html │ │ │ │ ├── popovers.component.html │ │ │ │ └── carousels.component.html │ │ │ ├── icons │ │ │ │ ├── flags.component.ts │ │ │ │ ├── coreui-icons.component.ts │ │ │ │ ├── font-awesome.component.ts │ │ │ │ ├── simple-line-icons.component.ts │ │ │ │ ├── icons.module.ts │ │ │ │ └── icons-routing.module.ts │ │ │ ├── buttons │ │ │ │ ├── buttons.component.ts │ │ │ │ ├── brand-buttons.component.ts │ │ │ │ ├── buttons.module.ts │ │ │ │ ├── dropdowns.component.ts │ │ │ │ └── buttons-routing.module.ts │ │ │ ├── notifications │ │ │ │ ├── badges.component.ts │ │ │ │ ├── modals.component.ts │ │ │ │ ├── notifications.module.ts │ │ │ │ ├── notifications-routing.module.ts │ │ │ │ ├── alerts.component.ts │ │ │ │ └── badges.component.html │ │ │ ├── theme │ │ │ │ ├── typography.component.ts │ │ │ │ ├── theme.module.ts │ │ │ │ ├── theme-routing.module.ts │ │ │ │ └── colors.component.ts │ │ │ ├── unauthorized │ │ │ │ ├── unauthorized.component.ts │ │ │ │ └── unauthorized.component.html │ │ │ ├── register │ │ │ │ ├── register.component.ts │ │ │ │ └── register.component.html │ │ │ ├── chartjs │ │ │ │ ├── chartjs.module.ts │ │ │ │ ├── chartjs-routing.module.ts │ │ │ │ ├── chartjs.component.ts │ │ │ │ └── chartjs.component.html │ │ │ ├── widgets │ │ │ │ ├── widgets-routing.module.ts │ │ │ │ └── widgets.module.ts │ │ │ ├── dashboard │ │ │ │ ├── dashboard-routing.module.ts │ │ │ │ └── dashboard.module.ts │ │ │ └── login │ │ │ │ ├── login-callback.component.ts │ │ │ │ ├── login.component.ts │ │ │ │ └── login.component.html │ │ ├── containers │ │ │ ├── index.ts │ │ │ └── default-layout │ │ │ │ ├── index.ts │ │ │ │ └── default-layout.component.ts │ │ ├── shared │ │ │ └── models │ │ │ │ └── moedas.model.ts │ │ ├── core │ │ │ ├── module-import-guard.ts │ │ │ ├── auth │ │ │ │ ├── auth-module-config.ts │ │ │ │ ├── auth-guard.service.ts │ │ │ │ ├── auth-config.ts │ │ │ │ └── auth-guard-with-forced-login.service.ts │ │ │ └── core.module.ts │ │ ├── app.component.ts │ │ ├── app.component.spec.ts │ │ ├── app.component.html │ │ ├── app.module.ts │ │ ├── app.routing.ts │ │ └── _nav.ts │ ├── scss │ │ ├── _variables.scss │ │ ├── _custom.scss │ │ ├── vendors │ │ │ ├── _variables.scss │ │ │ └── chart.js │ │ │ │ └── chart.scss │ │ └── style.scss │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── typings.d.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ ├── main.ts │ ├── test.ts │ ├── index.html │ └── polyfills.ts ├── e2e │ ├── tsconfig.e2e.json │ ├── app.po.ts │ └── app.e2e-spec.ts ├── .editorconfig ├── tsconfig.json ├── protractor.conf.js ├── karma.conf.js ├── package.json ├── tslint.json └── angular.json ├── VueJS ├── .eslintignore ├── static │ ├── img │ │ └── logo.png │ ├── silent-renew.html │ └── callback.html ├── test │ └── setup.js ├── .babelrc ├── index.html ├── build │ ├── utils.js │ ├── webpack.config.prod.js │ ├── webpack.config.dev.js │ └── webpack.config.base.js ├── .eslintrc.js ├── src │ ├── App.vue │ ├── services │ │ └── ApiService.js │ ├── pages │ │ ├── AccessDenied.vue │ │ ├── FreeUser.vue │ │ └── Admin.vue │ ├── router │ │ └── index.js │ └── index.js ├── LICENSE ├── .gitignore ├── package.json └── README.md └── .gitignore /Angular/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularOIDC/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /VueJS/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/cotacao/cotacao.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularOIDC/src/scss/_variables.scss: -------------------------------------------------------------------------------- 1 | // Variable overrides 2 | -------------------------------------------------------------------------------- /AngularOIDC/src/scss/_custom.scss: -------------------------------------------------------------------------------- 1 | // Here you can add other styles 2 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/containers/index.ts: -------------------------------------------------------------------------------- 1 | export * from './default-layout'; 2 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/containers/default-layout/index.ts: -------------------------------------------------------------------------------- 1 | export * from './default-layout.component'; 2 | -------------------------------------------------------------------------------- /Angular/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/Angular/src/favicon.ico -------------------------------------------------------------------------------- /AngularOIDC/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /Angular/screenshot-001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/Angular/screenshot-001.png -------------------------------------------------------------------------------- /VueJS/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/VueJS/static/img/logo.png -------------------------------------------------------------------------------- /AngularOIDC/src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/favicon.ico -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/1.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/2.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/3.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/4.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/5.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/6.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/7.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/avatars/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brunobritodev/oidc-samples/master/AngularOIDC/src/assets/img/avatars/8.jpg -------------------------------------------------------------------------------- /AngularOIDC/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /VueJS/test/setup.js: -------------------------------------------------------------------------------- 1 | // setup JSDOM 2 | require('jsdom-global')() 3 | 4 | // make expect available globally 5 | global.expect = require('expect') 6 | -------------------------------------------------------------------------------- /Angular/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | ResourceServer: 'http://api.teste.work' 4 | }; 5 | -------------------------------------------------------------------------------- /Angular/src/silent-refresh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AngularOIDC/src/scss/vendors/_variables.scss: -------------------------------------------------------------------------------- 1 | // Override Boostrap variables 2 | @import "../variables"; 3 | @import "node_modules/bootstrap/scss/mixins"; 4 | @import "node_modules/@coreui/coreui/scss/variables"; 5 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/shared/models/moedas.model.ts: -------------------------------------------------------------------------------- 1 | export class Moedas { 2 | public id: number; 3 | public nome: string; 4 | public simbolo: string; 5 | public rank: number; 6 | public preco: number; 7 | } -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/error/404.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: '404.component.html' 5 | }) 6 | export class P404Component { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/error/500.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: '500.component.html' 5 | }) 6 | export class P500Component { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/cards.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'cards.component.html' 5 | }) 6 | export class CardsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/tabs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'tabs.component.html' 5 | }) 6 | export class TabsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/icons/flags.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'flags.component.html' 5 | }) 6 | export class FlagsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/scss/style.scss: -------------------------------------------------------------------------------- 1 | // If you want to override variables do it here 2 | @import "variables"; 3 | 4 | // Import styles 5 | @import "~@coreui/coreui/scss/coreui"; 6 | 7 | // If you want to add something do it here 8 | @import "custom"; 9 | -------------------------------------------------------------------------------- /Angular/src/app/shared/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | 3 | import { ApiService } from './api.service'; 4 | 5 | @NgModule({ 6 | providers: [ 7 | ApiService, 8 | ] 9 | }) 10 | export class SharedModule { } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/tables.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'tables.component.html' 5 | }) 6 | export class TablesComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/switches.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'switches.component.html' 5 | }) 6 | export class SwitchesComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/buttons/buttons.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'buttons.component.html' 5 | }) 6 | export class ButtonsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/notifications/badges.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'badges.component.html' 5 | }) 6 | export class BadgesComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/theme/typography.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'typography.component.html' 5 | }) 6 | export class TypographyComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/unauthorized/unauthorized.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-dashboard', 5 | templateUrl: 'unauthorized.component.html' 6 | }) 7 | export class UnauthorizedComponent { } 8 | -------------------------------------------------------------------------------- /VueJS/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/preset-env", { 4 | "modules": "commonjs", 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"], 7 | "node": "current" 8 | } 9 | }] 10 | ] 11 | } -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/icons/coreui-icons.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'coreui-icons.component.html' 5 | }) 6 | export class CoreUIIconsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/icons/font-awesome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'font-awesome.component.html' 5 | }) 6 | export class FontAwesomeComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/buttons/brand-buttons.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'brand-buttons.component.html' 5 | }) 6 | export class BrandButtonsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Angular/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "esnext", 6 | "types": [] 7 | }, 8 | "exclude": [ 9 | "src/test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /AngularOIDC/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types":[ 8 | "jasmine", 9 | "node" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/icons/simple-line-icons.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'simple-line-icons.component.html' 5 | }) 6 | export class SimpleLineIconsComponent { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Angular/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Angular/src/app/fallback.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-fallback', 5 | template: `

This is the 🕳️ FALLBACK component.

`, 6 | }) 7 | export class FallbackComponent { 8 | } 9 | -------------------------------------------------------------------------------- /Angular/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /Angular/src/app/feature-basics/public.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-public', 5 | template: `

This is the 🌐 PUBLIC component.

`, 6 | }) 7 | export class PublicComponent { 8 | } 9 | -------------------------------------------------------------------------------- /AngularOIDC/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, element, by } from 'protractor/globals'; 2 | 3 | export class CoreUIPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-dashboard', 5 | templateUrl: 'register.component.html' 6 | }) 7 | export class RegisterComponent { 8 | 9 | constructor() { } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /VueJS/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | vuejsclient 7 | 8 | 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/core/module-import-guard.ts: -------------------------------------------------------------------------------- 1 | // https://angular.io/styleguide#!#04-12 2 | export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) { 3 | if (parentModule) 4 | throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`); 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Angular/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /AngularOIDC/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | max_line_length = off 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /VueJS/build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | 5 | module.exports = { 6 | resolve: function (dir) { 7 | return path.join(__dirname, '..', dir) 8 | }, 9 | 10 | assetsPath: function (_path) { 11 | const assetsSubDirectory = 'static' 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | } -------------------------------------------------------------------------------- /Angular/src/app/sso/auth-module-config.ts: -------------------------------------------------------------------------------- 1 | import { OAuthModuleConfig } from 'angular-oauth2-oidc'; 2 | import { environment } from 'src/environments/environment'; 3 | 4 | export const authModuleConfig: OAuthModuleConfig = { 5 | resourceServer: { 6 | allowedUrls: [environment.ResourceServer], 7 | sendAccessToken: true, 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/core/auth/auth-module-config.ts: -------------------------------------------------------------------------------- 1 | import { OAuthModuleConfig } from 'angular-oauth2-oidc'; 2 | import { environment } from '../../../environments/environment'; 3 | 4 | export const authModuleConfig: OAuthModuleConfig = { 5 | resourceServer: { 6 | allowedUrls: [environment.ResourceServer], 7 | sendAccessToken: true 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /VueJS/static/silent-renew.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Silent Renew Token for SpeEDI Cargo 5 | 6 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /Angular/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "module": "commonjs", 6 | "types": [ 7 | "jasmine", 8 | "node" 9 | ] 10 | }, 11 | "files": [ 12 | "test.ts", 13 | "polyfills.ts" 14 | ], 15 | "include": [ 16 | "**/*.spec.ts", 17 | "**/*.d.ts" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /AngularOIDC/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { CoreUIPage } from './app.po'; 2 | 3 | describe('core-ui App', function() { 4 | let page: CoreUIPage; 5 | 6 | beforeEach(() => { 7 | page = new CoreUIPage(); 8 | }); 9 | 10 | it('should display message saying app works', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('app works!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /Angular/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('workspace-project App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to sample-auth-guards!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /Angular/src/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 | -------------------------------------------------------------------------------- /AngularOIDC/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [], 8 | "paths": { 9 | "@angular/*": [ 10 | "../node_modules/@angular/*" 11 | ] 12 | } 13 | }, 14 | "exclude": [ 15 | "test.ts", 16 | "**/*.spec.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /Angular/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed 5 | > 0.5% 6 | last 2 versions 7 | Firefox ESR 8 | not dead 9 | # IE 9-11 -------------------------------------------------------------------------------- /AngularOIDC/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "types": [ 8 | "jasmine", 9 | "node" 10 | ] 11 | }, 12 | "files": [ 13 | "test.ts", 14 | "polyfills.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /Angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /Angular/src/app/sso/auth-config.ts: -------------------------------------------------------------------------------- 1 | import { AuthConfig } from 'angular-oauth2-oidc'; 2 | 3 | export const authConfig: AuthConfig = { 4 | issuer: 'http://sso.teste.work', 5 | clientId: 'angular-demo', 6 | redirectUri: window.location.origin + '/index.html', 7 | silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html', 8 | scope: 'openid profile email api_demo.api jp_api.user', 9 | requireHttps: false, 10 | }; 11 | -------------------------------------------------------------------------------- /AngularOIDC/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /Angular/src/styles.css: -------------------------------------------------------------------------------- 1 | .authenticating-loader { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | position: fixed; 6 | top: 0; 7 | right: 0; 8 | bottom: 0; 9 | left: 0; 10 | font-size: 5rem; 11 | background: #fff; 12 | opacity: 0.8; 13 | } 14 | 15 | .pre { 16 | white-space: pre; 17 | } 18 | 19 | .break-all { 20 | word-break: break-all; 21 | } 22 | 23 | .table-props tr th { 24 | width: 1px; 25 | } 26 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/collapses.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'collapses.component.html' 5 | }) 6 | export class CollapsesComponent { 7 | 8 | constructor() { } 9 | 10 | isCollapsed: boolean = false; 11 | 12 | collapsed(event: any): void { 13 | // console.log(event); 14 | } 15 | 16 | expanded(event: any): void { 17 | // console.log(event); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/chartjs/chartjs.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { ChartsModule } from 'ng2-charts/ng2-charts'; 3 | 4 | import { ChartJSComponent } from './chartjs.component'; 5 | import { ChartJSRoutingModule } from './chartjs-routing.module'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | ChartJSRoutingModule, 10 | ChartsModule 11 | ], 12 | declarations: [ ChartJSComponent ] 13 | }) 14 | export class ChartJSModule { } 15 | -------------------------------------------------------------------------------- /AngularOIDC/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "moduleResolution": "node", 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ], 15 | "lib": [ 16 | "es2017", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/notifications/modals.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { ModalDirective } from 'ngx-bootstrap/modal'; 3 | 4 | @Component({ 5 | templateUrl: 'modals.component.html' 6 | }) 7 | export class ModalsComponent { 8 | public myModal; 9 | public largeModal; 10 | public smallModal; 11 | public primaryModal; 12 | public successModal; 13 | public warningModal; 14 | public dangerModal; 15 | public infoModal; 16 | } 17 | -------------------------------------------------------------------------------- /VueJS/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | parser: 'babel-eslint' 5 | }, 6 | env: { 7 | browser: true, 8 | node: true, 9 | mocha: true 10 | }, 11 | "globals": { 12 | "expect": true 13 | }, 14 | extends: [ 15 | 'plugin:vue/recommended', 16 | 'standard' 17 | ], 18 | plugins: [ 19 | 'vue' 20 | ], 21 | rules: { 22 | 'generator-star-spacing': 'off', 23 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 24 | } 25 | } -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/chartjs/chartjs-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { ChartJSComponent } from './chartjs.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: ChartJSComponent, 10 | data: { 11 | title: 'Charts' 12 | } 13 | } 14 | ]; 15 | 16 | @NgModule({ 17 | imports: [RouterModule.forChild(routes)], 18 | exports: [RouterModule] 19 | }) 20 | export class ChartJSRoutingModule {} 21 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/widgets/widgets-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { WidgetsComponent } from './widgets.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: WidgetsComponent, 10 | data: { 11 | title: 'Widgets' 12 | } 13 | } 14 | ]; 15 | 16 | @NgModule({ 17 | imports: [RouterModule.forChild(routes)], 18 | exports: [RouterModule] 19 | }) 20 | export class WidgetsRoutingModule {} 21 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/widgets/widgets.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { ChartsModule } from 'ng2-charts/ng2-charts'; 3 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; 4 | 5 | import { WidgetsComponent } from './widgets.component'; 6 | import { WidgetsRoutingModule } from './widgets-routing.module'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | WidgetsRoutingModule, 11 | ChartsModule, 12 | BsDropdownModule 13 | ], 14 | declarations: [ WidgetsComponent ] 15 | }) 16 | export class WidgetsModule { } 17 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/dashboard/dashboard-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, 3 | RouterModule } from '@angular/router'; 4 | 5 | import { DashboardComponent } from './dashboard.component'; 6 | 7 | const routes: Routes = [ 8 | { 9 | path: '', 10 | component: DashboardComponent, 11 | data: { 12 | title: 'Dashboard' 13 | } 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [RouterModule.forChild(routes)], 19 | exports: [RouterModule] 20 | }) 21 | export class DashboardRoutingModule {} 22 | -------------------------------------------------------------------------------- /Angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SampleAuthGuards 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/tooltips.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, SecurityContext} from '@angular/core'; 2 | import {DomSanitizer} from "@angular/platform-browser"; 3 | 4 | @Component({ 5 | templateUrl: 'tooltips.component.html' 6 | }) 7 | export class TooltipsComponent { 8 | 9 | constructor(sanitizer: DomSanitizer) { 10 | this.html = sanitizer.sanitize(SecurityContext.HTML, this.html) 11 | } 12 | 13 | content: string = 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.'; 14 | html: string = `Never trust not sanitized HTML!!!`; 15 | } 16 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/cotacao/cotacao.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { CotacaoComponent } from './cotacao.component'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: CotacaoComponent 10 | } 11 | ]; 12 | 13 | @NgModule({ 14 | imports: [ 15 | CommonModule, 16 | RouterModule.forChild(routes) 17 | ], 18 | exports: [RouterModule], 19 | declarations: [CotacaoComponent] 20 | }) 21 | export class CotacaoModule { } 22 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/theme/theme.module.ts: -------------------------------------------------------------------------------- 1 | // Angular 2 | import { CommonModule } from '@angular/common'; 3 | import { NgModule } from '@angular/core'; 4 | 5 | import { ColorsComponent } from './colors.component'; 6 | import { TypographyComponent } from './typography.component'; 7 | 8 | // Theme Routing 9 | import { ThemeRoutingModule } from './theme-routing.module'; 10 | 11 | @NgModule({ 12 | imports: [ 13 | CommonModule, 14 | ThemeRoutingModule 15 | ], 16 | declarations: [ 17 | ColorsComponent, 18 | TypographyComponent 19 | ] 20 | }) 21 | export class ThemeModule { } 22 | -------------------------------------------------------------------------------- /Angular/src/app/should-login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { OAuthService } from 'angular-oauth2-oidc'; 3 | 4 | @Component({ 5 | selector: 'app-should-login', 6 | template: `

You need to be logged in to view requested page.

7 |

Please log in before continuing.

`, 8 | }) 9 | export class ShouldLoginComponent { 10 | constructor(private authService: OAuthService) { } 11 | 12 | public login($event) { 13 | $event.preventDefault(); 14 | this.authService.initImplicitFlow(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Angular/src/app/feature-basics/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { ApiService } from '../shared/api.service'; 3 | import { Observable } from 'rxjs'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | template: `

8 | This is the 🏠 HOME component. 9 | - {{ apiResponse | async }} 10 |

`, 11 | }) 12 | export class HomeComponent { 13 | apiResponse: Observable; 14 | 15 | constructor(private apiService: ApiService) { } 16 | 17 | ngOnInit() { 18 | this.apiResponse = this.apiService.getProtectedApiResponse(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AngularOIDC/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false, 8 | API_URL: "http://localhost:5020/", 9 | ResourceServer: "http://localhost:5020", 10 | IssuerUri: "http://localhost:5000", 11 | RequireHttps: false, 12 | Uri: "http://localhost:4200" 13 | }; 14 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/popovers.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, SecurityContext} from '@angular/core'; 2 | import {DomSanitizer} from '@angular/platform-browser'; 3 | 4 | 5 | @Component({ 6 | templateUrl: 'popovers.component.html' 7 | }) 8 | export class PopoversComponent { 9 | 10 | constructor(sanitizer: DomSanitizer) { 11 | this.html = sanitizer.sanitize(SecurityContext.HTML, this.html) 12 | } 13 | 14 | title: string = 'Welcome word'; 15 | content: string = 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.'; 16 | html: string = `Never trust not sanitized HTML!!!`; 17 | } 18 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/forms.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'forms.component.html' 5 | }) 6 | export class FormsComponent { 7 | 8 | constructor() { } 9 | 10 | isCollapsed: boolean = false; 11 | iconCollapse: string = "icon-arrow-up"; 12 | 13 | collapsed(event: any): void { 14 | // console.log(event); 15 | } 16 | 17 | expanded(event: any): void { 18 | // console.log(event); 19 | } 20 | 21 | toggleCollapse(): void { 22 | this.isCollapsed = !this.isCollapsed; 23 | this.iconCollapse = this.isCollapsed ? "icon-arrow-down" : "icon-arrow-up"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /VueJS/src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 34 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/icons/icons.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | 3 | import { CoreUIIconsComponent } from './coreui-icons.component'; 4 | import { FlagsComponent } from './flags.component'; 5 | import { FontAwesomeComponent } from './font-awesome.component'; 6 | import { SimpleLineIconsComponent } from './simple-line-icons.component'; 7 | 8 | import { IconsRoutingModule } from './icons-routing.module'; 9 | 10 | @NgModule({ 11 | imports: [ IconsRoutingModule ], 12 | declarations: [ 13 | CoreUIIconsComponent, 14 | FlagsComponent, 15 | FontAwesomeComponent, 16 | SimpleLineIconsComponent 17 | ] 18 | }) 19 | export class IconsModule { } 20 | -------------------------------------------------------------------------------- /Angular/.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 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /Angular/src/app/feature-extras/admin2.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | import { ApiService } from '../shared/api.service'; 4 | 5 | @Component({ 6 | selector: 'app-admin', 7 | template: `

8 | This is the 🔧 ADMIN 2 component. 9 | It will redirect you to login if needed. 10 | - {{ apiResponse | async }} 11 |

`, 12 | }) 13 | export class Admin2Component implements OnInit { 14 | apiResponse: Observable; 15 | 16 | constructor(private apiService: ApiService) { } 17 | 18 | ngOnInit() { 19 | this.apiResponse = this.apiService.getProtectedApiResponse(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Angular/src/app/feature-basics/admin1.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | 4 | import { ApiService } from '../shared/api.service'; 5 | 6 | @Component({ 7 | selector: 'app-admin', 8 | template: `

9 | This is the ⚙ ADMIN component. 10 | It will not redirect you to the login server. 11 | - {{ apiResponse | async }} 12 |

`, 13 | }) 14 | export class Admin1Component implements OnInit { 15 | apiResponse: Observable; 16 | 17 | constructor(private apiService: ApiService) { } 18 | 19 | ngOnInit() { 20 | this.apiResponse = this.apiService.getProtectedApiResponse(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import { getTestBed } from '@angular/core/testing'; 4 | import { 5 | BrowserDynamicTestingModule, 6 | platformBrowserDynamicTesting 7 | } from '@angular/platform-browser-dynamic/testing'; 8 | import 'zone.js/dist/zone-testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/dashboard/dashboard.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { ChartsModule } from 'ng2-charts/ng2-charts'; 4 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; 5 | import { ButtonsModule } from 'ngx-bootstrap/buttons'; 6 | 7 | import { DashboardComponent } from './dashboard.component'; 8 | import { DashboardRoutingModule } from './dashboard-routing.module'; 9 | 10 | @NgModule({ 11 | imports: [ 12 | FormsModule, 13 | DashboardRoutingModule, 14 | ChartsModule, 15 | BsDropdownModule, 16 | ButtonsModule.forRoot() 17 | ], 18 | declarations: [ DashboardComponent ] 19 | }) 20 | export class DashboardModule { } 21 | -------------------------------------------------------------------------------- /AngularOIDC/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: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /VueJS/static/callback.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Waiting... 7 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Angular/src/app/feature-extras/extras.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { RouterModule } from '@angular/router'; 4 | 5 | import { AuthGuardWithForcedLogin } from '../sso/auth-guard-with-forced-login.service'; 6 | import { SharedModule } from '../shared/shared.module'; 7 | 8 | import { Admin2Component } from './admin2.component'; 9 | 10 | @NgModule({ 11 | declarations: [ 12 | Admin2Component, 13 | ], 14 | imports: [ 15 | CommonModule, 16 | SharedModule, 17 | RouterModule.forChild([ 18 | { path: 'admin2', component: Admin2Component, canActivate: [AuthGuardWithForcedLogin] }, 19 | ]), 20 | ], 21 | }) 22 | export class ExtrasModule { } 23 | -------------------------------------------------------------------------------- /Angular/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 | ResourceServer: 'http://api.teste.work' 8 | }; 9 | 10 | /* 11 | * In development mode, to ignore zone related error stack frames such as 12 | * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can 13 | * import the following file, but please comment it out in production mode 14 | * because it will have performance impact when throw error 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /Angular/src/app/sso/auth-guard.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | import { tap } from 'rxjs/operators'; 5 | 6 | import { AuthService } from './auth.service'; 7 | 8 | @Injectable() 9 | export class AuthGuard implements CanActivate { 10 | constructor( 11 | private authService: AuthService, 12 | ) { } 13 | 14 | canActivate( 15 | route: ActivatedRouteSnapshot, 16 | state: RouterStateSnapshot, 17 | ): Observable { 18 | return this.authService.canActivateProtectedRoutes$ 19 | .pipe(tap(x => console.log('You tried to go to ' + state.url + ' and this guard said ' + x))); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/core/auth/auth-guard.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | import { tap } from 'rxjs/operators'; 5 | 6 | import { AuthService } from './auth.service'; 7 | 8 | @Injectable() 9 | export class AuthGuard implements CanActivate { 10 | constructor( 11 | private authService: AuthService, 12 | ) { } 13 | 14 | canActivate( 15 | route: ActivatedRouteSnapshot, 16 | state: RouterStateSnapshot, 17 | ): Observable { 18 | return this.authService.canActivateProtectedRoutes$ 19 | .pipe(tap(x => console.log('You tried to go to ' + state.url + ' and this guard said ' + x))); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /VueJS/src/services/ApiService.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import axios from 'axios' 3 | import Mgr from './SecurityService' 4 | import 'babel-polyfill'; 5 | 6 | const baseUrl = 'http://api.teste.work/'; 7 | var user = new Mgr() 8 | 9 | export default class ApiService { 10 | 11 | async defineHeaderAxios () { 12 | await user.getAcessToken().then( 13 | acessToken => { 14 | axios.defaults.headers.common['Authorization'] = 'Bearer ' + acessToken 15 | }, err => { 16 | console.log(err) 17 | }) 18 | } 19 | 20 | async get(api){ 21 | await this.defineHeaderAxios() 22 | return axios 23 | .get(baseUrl + api) 24 | .then(response => response.data) 25 | .catch(err => { 26 | console.log(err); 27 | }) 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/core/auth/auth-config.ts: -------------------------------------------------------------------------------- 1 | import { AuthConfig } from 'angular-oauth2-oidc'; 2 | 3 | export const authConfig: AuthConfig = { 4 | issuer: 'http://sso.teste.work', 5 | clientId: 'angular-demo', 6 | scope: 'openid profile email api_demo.api jp_api.user', 7 | 8 | redirectUri: window.location.origin , 9 | silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html', 10 | requireHttps: false, 11 | silentRefreshTimeout: 5000, // For faster testing 12 | timeoutFactor: 0.25, // For faster testing 13 | sessionChecksEnabled: true, 14 | showDebugInformation: true, // Also requires enabling "Verbose" level in devtools 15 | clearHashAfterLogin: false, // https://github.com/manfredsteyer/angular-oauth2-oidc/issues/457#issuecomment-431807040 16 | }; -------------------------------------------------------------------------------- /AngularOIDC/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router, NavigationEnd } from '@angular/router'; 3 | import { AuthService } from './core/auth/auth.service'; 4 | 5 | @Component({ 6 | // tslint:disable-next-line 7 | selector: 'body', 8 | template: '' 9 | }) 10 | export class AppComponent implements OnInit { 11 | constructor(private router: Router, 12 | private authService: AuthService) { 13 | 14 | this.authService.runInitialLoginSequence(); 15 | } 16 | 17 | 18 | ngOnInit() { 19 | this.router.events.subscribe((evt) => { 20 | if (!(evt instanceof NavigationEnd)) { 21 | return; 22 | } 23 | window.scrollTo(0, 0); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Angular/src/app/shared/api.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Observable, of } from 'rxjs'; 3 | import { HttpClient, HttpErrorResponse } from '@angular/common/http'; 4 | import { map, catchError, tap } from 'rxjs/operators'; 5 | import { environment } from 'src/environments/environment'; 6 | 7 | @Injectable() 8 | export class ApiService { 9 | constructor(private http: HttpClient) { } 10 | 11 | getProtectedApiResponse(): Observable { 12 | return this.http.get(`${environment.ResourceServer}/management/user-data`) 13 | .pipe( 14 | map((response: any) => response.data.userName), 15 | map(iss => '☁ API Success! Username ' + iss), 16 | catchError((e: HttpErrorResponse) => of(`🌩 API Error: ${e.status} ${e.statusText}`)), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/login/login-callback.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; 2 | import { Router } from "@angular/router"; 3 | import { AuthService } from '../../core/auth/auth.service'; 4 | import { Subscription } from 'rxjs'; 5 | 6 | @Component({ 7 | template: '' 8 | }) 9 | export class LoginCallbackComponent implements OnInit, OnDestroy { 10 | stream: Subscription; 11 | constructor(private authService: AuthService, private router: Router) { 12 | } 13 | 14 | ngOnInit() { 15 | this.stream = this.authService.canActivateProtectedRoutes$.subscribe(yes => { 16 | if (yes) 17 | this.router.navigate(["/dashboard"]); 18 | 19 | }); 20 | 21 | } 22 | public ngOnDestroy() { 23 | this.stream.unsubscribe(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AngularOIDC/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /Angular/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/paginations.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, ViewEncapsulation } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'paginations.component.html', 5 | styles: ['.pager li.btn:active { box-shadow: none; }'], 6 | encapsulation: ViewEncapsulation.None 7 | }) 8 | export class PaginationsComponent { 9 | 10 | constructor() { } 11 | 12 | totalItems: number = 64; 13 | currentPage: number = 4; 14 | smallnumPages: number = 0; 15 | 16 | setPage(pageNo: number): void { 17 | this.currentPage = pageNo; 18 | } 19 | 20 | pageChanged(event: any): void { 21 | console.log('Page changed to: ' + event.page); 22 | console.log('Number items per page: ' + event.itemsPerPage); 23 | } 24 | 25 | maxSize: number = 5; 26 | bigTotalItems: number = 675; 27 | bigCurrentPage: number = 1; 28 | numPages: number = 0; 29 | 30 | currentPager: number = 4; 31 | } 32 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/buttons/buttons.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { NgModule } from '@angular/core'; 4 | 5 | import { ButtonsComponent } from './buttons.component'; 6 | import { BrandButtonsComponent } from './brand-buttons.component'; 7 | 8 | // Dropdowns Component 9 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; 10 | import { DropdownsComponent } from './dropdowns.component'; 11 | 12 | // Buttons Routing 13 | import { ButtonsRoutingModule } from './buttons-routing.module'; 14 | 15 | // Angular 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | ButtonsRoutingModule, 21 | BsDropdownModule.forRoot(), 22 | FormsModule 23 | ], 24 | declarations: [ 25 | ButtonsComponent, 26 | DropdownsComponent, 27 | BrandButtonsComponent 28 | ] 29 | }) 30 | export class ButtonsModule { } 31 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/theme/theme-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { ColorsComponent } from './colors.component'; 5 | import { TypographyComponent } from './typography.component'; 6 | 7 | const routes: Routes = [ 8 | { 9 | path: '', 10 | data: { 11 | title: 'Theme' 12 | }, 13 | children: [ 14 | { 15 | path: 'colors', 16 | component: ColorsComponent, 17 | data: { 18 | title: 'Colors' 19 | } 20 | }, 21 | { 22 | path: 'typography', 23 | component: TypographyComponent, 24 | data: { 25 | title: 'Typography' 26 | } 27 | } 28 | ] 29 | } 30 | ]; 31 | 32 | @NgModule({ 33 | imports: [RouterModule.forChild(routes)], 34 | exports: [RouterModule] 35 | }) 36 | export class ThemeRoutingModule {} 37 | -------------------------------------------------------------------------------- /AngularOIDC/src/index.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | CoreUI - Free Angular Admin Template 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/containers/default-layout/default-layout.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { navItems } from '../../_nav'; 3 | import { OAuthService } from 'angular-oauth2-oidc'; 4 | 5 | @Component({ 6 | selector: 'app-dashboard', 7 | templateUrl: './default-layout.component.html' 8 | }) 9 | export class DefaultLayoutComponent { 10 | public navItems = navItems; 11 | public sidebarMinimized = true; 12 | private changes: MutationObserver; 13 | public element: HTMLElement = document.body; 14 | constructor(private oauthService: OAuthService) { 15 | 16 | this.changes = new MutationObserver((mutations) => { 17 | this.sidebarMinimized = document.body.classList.contains('sidebar-minimized') 18 | }); 19 | 20 | this.changes.observe(this.element, { 21 | attributes: true 22 | }); 23 | } 24 | 25 | public logout(){ 26 | this.oauthService.logOut(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/notifications/notifications.module.ts: -------------------------------------------------------------------------------- 1 | // Angular 2 | import { CommonModule } from '@angular/common'; 3 | import { NgModule } from '@angular/core'; 4 | 5 | // Alert Component 6 | import { AlertModule } from 'ngx-bootstrap/alert'; 7 | import { AlertsComponent } from './alerts.component'; 8 | 9 | import { BadgesComponent } from './badges.component'; 10 | 11 | // Modal Component 12 | import { ModalModule } from 'ngx-bootstrap/modal'; 13 | import { ModalsComponent } from './modals.component'; 14 | 15 | // Notifications Routing 16 | import { NotificationsRoutingModule } from './notifications-routing.module'; 17 | 18 | @NgModule({ 19 | imports: [ 20 | CommonModule, 21 | NotificationsRoutingModule, 22 | AlertModule.forRoot(), 23 | ModalModule.forRoot() 24 | ], 25 | declarations: [ 26 | AlertsComponent, 27 | BadgesComponent, 28 | ModalsComponent 29 | ] 30 | }) 31 | export class NotificationsModule { } 32 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/carousels.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { CarouselConfig } from 'ngx-bootstrap/carousel'; 3 | 4 | @Component({ 5 | templateUrl: 'carousels.component.html', providers: [ 6 | { provide: CarouselConfig, useValue: { interval: 1500, noPause: true } } 7 | ] 8 | }) 9 | export class CarouselsComponent { 10 | 11 | myInterval: number = 6000; 12 | slides: any[] = []; 13 | activeSlideIndex: number = 0; 14 | noWrapSlides: boolean = false; 15 | 16 | constructor() { 17 | for (let i = 0; i < 4; i++) { 18 | this.addSlide(); 19 | } 20 | } 21 | 22 | addSlide(): void { 23 | this.slides.push({ 24 | image: `https://lorempixel.com/900/500/sports/${this.slides.length % 8 + 1}/` 25 | }); 26 | } 27 | 28 | removeSlide(index?: number): void { 29 | const toRemove = index ? index : this.activeSlideIndex; 30 | this.slides.splice(toRemove, 1); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/error/404.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |

404

7 |

Oops! You're lost.

8 |

The page you are looking for was not found.

9 |
10 |
11 |
12 | 13 |
14 | 15 | 16 | 17 | 18 |
19 |
20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /Angular/src/app/sso/auth-guard-with-forced-login.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | import { filter, map, tap } from 'rxjs/operators'; 5 | 6 | import { AuthService } from './auth.service'; 7 | 8 | @Injectable() 9 | export class AuthGuardWithForcedLogin implements CanActivate { 10 | private isAuthenticated: boolean; 11 | 12 | constructor( 13 | private authService: AuthService, 14 | ) { 15 | this.authService.isAuthenticated$.subscribe(i => this.isAuthenticated = i); 16 | } 17 | 18 | canActivate( 19 | route: ActivatedRouteSnapshot, 20 | state: RouterStateSnapshot, 21 | ): Observable { 22 | return this.authService.isDoneLoading$ 23 | .pipe(filter(isDone => isDone)) 24 | .pipe(tap(_ => this.isAuthenticated || this.authService.login(state.url))) 25 | .pipe(map(_ => this.isAuthenticated)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/core/auth/auth-guard-with-forced-login.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | import { filter, map, tap } from 'rxjs/operators'; 5 | 6 | import { AuthService } from './auth.service'; 7 | 8 | @Injectable() 9 | export class AuthGuardWithForcedLogin implements CanActivate { 10 | private isAuthenticated: boolean; 11 | 12 | constructor( 13 | private authService: AuthService, 14 | ) { 15 | this.authService.isAuthenticated$.subscribe(i => this.isAuthenticated = i); 16 | } 17 | 18 | canActivate( 19 | route: ActivatedRouteSnapshot, 20 | state: RouterStateSnapshot, 21 | ): Observable { 22 | return this.authService.isDoneLoading$ 23 | .pipe(filter(isDone => isDone)) 24 | .pipe(tap(_ => this.isAuthenticated || this.authService.login(state.url))) 25 | .pipe(map(_ => this.isAuthenticated)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/error/500.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |

500

7 |

Houston, we have a problem!

8 |

The page you are looking for is temporarily unavailable.

9 |
10 |
11 |
12 | 13 |
14 | 15 | 16 | 17 | 18 |
19 |
20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/cotacao/cotacao.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Observable, Subscription } from '../../../../node_modules/rxjs'; 3 | import { CotacaoService } from './cotacao.service'; 4 | import { IntervalObservable } from "rxjs/observable/IntervalObservable"; 5 | import { Moedas } from '../../shared/models/moedas.model'; 6 | 7 | @Component({ 8 | templateUrl: './cotacao.component.html', 9 | styleUrls: ['./cotacao.component.scss'] 10 | }) 11 | export class CotacaoComponent implements OnInit { 12 | 13 | public cotacoes: Observable; 14 | sub: Subscription; 15 | constructor(private cotacaoService: CotacaoService) { } 16 | 17 | ngOnInit() { 18 | this.obterCotacoes(); 19 | this.sub = IntervalObservable.create(35000).subscribe(() => this.obterCotacoes()); 20 | } 21 | 22 | public ngOnDestroy(): void { 23 | this.sub.unsubscribe(); 24 | } 25 | 26 | public obterCotacoes() { 27 | this.cotacoes = this.cotacaoService.obterCotacoes(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/cotacao/cotacao.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '../../../../node_modules/@angular/common/http'; 3 | import { Observable } from '../../../../node_modules/rxjs'; 4 | import { environment } from '../../../environments/environment'; 5 | import { OAuthService } from '../../../../node_modules/angular-oauth2-oidc'; 6 | import { Moedas } from '../../shared/models/moedas.model'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class CotacaoService { 12 | 13 | private defaultHeader: HttpHeaders; 14 | constructor(private http: HttpClient, private oauth: OAuthService) { 15 | this.defaultHeader = new HttpHeaders().set('Accept', 'application/json').set('Authorization', 'Bearer ' + this.oauth.getAccessToken()); 16 | 17 | } 18 | 19 | public obterCotacoes(): Observable { 20 | const url = "cotacao/cripto-moedas"; 21 | 22 | return this.http.get(environment.API_URL + url); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /VueJS/build/webpack.config.prod.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const merge = require('webpack-merge') 4 | const baseConfig = require('./webpack.config.base') 5 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 6 | 7 | module.exports = merge(baseConfig, { 8 | mode: 'production', 9 | optimization: { 10 | splitChunks: { 11 | cacheGroups: { 12 | commons: { 13 | test: /[\\/]node_modules[\\/]/, 14 | name: "vendor", 15 | chunks: "all", 16 | }, 17 | }, 18 | }, 19 | }, 20 | module: { 21 | rules: [ 22 | { 23 | test: /\.css?$/, 24 | use: [ 25 | MiniCssExtractPlugin.loader, 26 | 'css-loader' 27 | ] 28 | }, { 29 | test: /\.styl(us)?$/, 30 | use: [ 31 | MiniCssExtractPlugin.loader, 32 | 'css-loader', 33 | 'stylus-loader' 34 | ] 35 | } 36 | ] 37 | }, 38 | plugins: [ 39 | new MiniCssExtractPlugin({ 40 | filename: 'main.css' 41 | }) 42 | ] 43 | }) -------------------------------------------------------------------------------- /VueJS/src/pages/AccessDenied.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 33 | -------------------------------------------------------------------------------- /Angular/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018, Jeroen Heijmans 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /VueJS/src/pages/FreeUser.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 34 | -------------------------------------------------------------------------------- /VueJS/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Home from '../pages/Home' 4 | import Admin from '../pages/Admin' 5 | import FreeUser from '../pages/FreeUser' 6 | import AccessDenied from '../pages/AccessDenied' 7 | 8 | Vue.use(Router) 9 | 10 | export default new Router({ 11 | routes: [ 12 | { 13 | path: '/', 14 | name: 'Home', 15 | component: Home, 16 | meta: { 17 | requiresAuth: false 18 | } 19 | }, 20 | { 21 | path: '/admin', 22 | name: 'Admin', 23 | component: Admin, 24 | meta: { 25 | requiresAuth: true, 26 | role: ['Administrador'] 27 | } 28 | }, 29 | { 30 | path: '/freeuser', 31 | name: 'FreeUser', 32 | component: FreeUser, 33 | meta: { 34 | requiresAuth: true 35 | } 36 | }, 37 | { 38 | path: '/accessdenied', 39 | name: 'AccessDenied', 40 | component: AccessDenied, 41 | meta: { 42 | requiresAuth: false 43 | } 44 | } 45 | ] 46 | }) 47 | -------------------------------------------------------------------------------- /VueJS/src/pages/Admin.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 35 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/buttons/dropdowns.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'dropdowns.component.html', 5 | }) 6 | export class DropdownsComponent { 7 | 8 | constructor() { } 9 | 10 | items: string[] = [ 11 | 'The first choice!', 12 | 'And another choice for you.', 13 | 'but wait! A third!' 14 | ]; 15 | 16 | onHidden(): void { 17 | console.log('Dropdown is hidden'); 18 | } 19 | onShown(): void { 20 | console.log('Dropdown is shown'); 21 | } 22 | isOpenChange(): void { 23 | console.log('Dropdown state is changed'); 24 | } 25 | 26 | status: { isOpen: boolean } = { isOpen: false }; 27 | 28 | toggleDropdown($event: MouseEvent): void { 29 | $event.preventDefault(); 30 | $event.stopPropagation(); 31 | this.status.isOpen = !this.status.isOpen; 32 | } 33 | 34 | change(value: boolean): void { 35 | this.status.isOpen = value; 36 | } 37 | 38 | disabled: boolean = false; 39 | 40 | isDropup: boolean = true; 41 | 42 | autoClose: boolean = false; 43 | } 44 | -------------------------------------------------------------------------------- /Angular/src/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'), 20 | reports: ['html', 'lcovonly'], 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 | }); 31 | }; -------------------------------------------------------------------------------- /AngularOIDC/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'app'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('app'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/collapses.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Bootstrap Collapse 5 | 10 |
11 |
15 |

16 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo 17 | consequat. 18 |

19 |
20 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /Angular/src/app/feature-basics/basics.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { RouterModule } from '@angular/router'; 4 | 5 | import { AuthGuard } from '../sso/auth-guard.service'; 6 | import { ApiService } from '../shared/api.service'; 7 | import { SharedModule } from '../shared/shared.module'; 8 | 9 | import { Admin1Component } from './admin1.component'; 10 | import { HomeComponent } from './home.component'; 11 | import { PublicComponent } from './public.component'; 12 | 13 | @NgModule({ 14 | declarations: [ 15 | Admin1Component, 16 | HomeComponent, 17 | PublicComponent, 18 | ], 19 | imports: [ 20 | CommonModule, 21 | SharedModule, 22 | RouterModule.forChild([ 23 | { path: '', redirectTo: 'home', pathMatch: 'full' }, 24 | { path: 'home', component: HomeComponent }, 25 | { path: 'admin1', component: Admin1Component, canActivate: [AuthGuard] }, 26 | { path: 'public', component: PublicComponent }, 27 | ]), 28 | ], 29 | providers: [ 30 | ApiService, 31 | ], 32 | }) 33 | export class BasicsModule { } 34 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { OAuthService } from 'angular-oauth2-oidc'; 3 | import { AuthService } from '../../core/auth/auth.service'; 4 | import { Subscription } from 'rxjs'; 5 | import { Router } from '@angular/router'; 6 | 7 | @Component({ 8 | selector: 'app-dashboard', 9 | templateUrl: 'login.component.html' 10 | }) 11 | export class LoginComponent implements OnInit, OnDestroy { 12 | private stream: Subscription; 13 | 14 | constructor( 15 | private authService: AuthService, 16 | private router: Router) { 17 | 18 | } 19 | 20 | public ngOnInit() { 21 | this.stream = this.authService.canActivateProtectedRoutes$.subscribe(yes => { 22 | if (yes) 23 | this.router.navigate(['/home']); 24 | else 25 | this.authService.login('/login-callback'); 26 | }); 27 | } 28 | 29 | public ngOnDestroy() { 30 | this.stream.unsubscribe(); 31 | } 32 | 33 | public login() { this.authService.login('/login-callback'); } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /VueJS/build/webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const webpack = require('webpack') 4 | const merge = require('webpack-merge') 5 | const baseConfig = require('./webpack.config.base') 6 | 7 | const HOST = 'localhost' 8 | const PORT = 8080 9 | 10 | module.exports = merge(baseConfig, { 11 | mode: 'development', 12 | 13 | devServer: { 14 | clientLogLevel: 'warning', 15 | hot: true, 16 | contentBase: 'dist', 17 | compress: true, 18 | host: HOST, 19 | port: PORT, 20 | open: true, 21 | overlay: { warnings: false, errors: true }, 22 | publicPath: '/', 23 | quiet: true, 24 | watchOptions: { 25 | poll: true 26 | } 27 | }, 28 | 29 | module: { 30 | rules: [ 31 | { 32 | test: /\.css$/, 33 | use: [ 34 | 'vue-style-loader', 35 | 'css-loader' 36 | ] 37 | }, { 38 | test: /\.styl(us)?$/, 39 | use: [ 40 | 'vue-style-loader', 41 | 'css-loader', 42 | 'stylus-loader' 43 | ] 44 | } 45 | ] 46 | }, 47 | 48 | plugins: [ 49 | new webpack.HotModuleReplacementPlugin() 50 | ] 51 | }) -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/cotacao/cotacao.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |
7 | Cotação atual de moedas virtuais 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
NomeSimboloRankPreco
{{cotacao.nome}}{{cotacao.simbolo}}{{cotacao.rank}}USD {{ cotacao.preco | currency }}
28 |
29 |
30 |
31 | 32 |
33 |
-------------------------------------------------------------------------------- /AngularOIDC/src/app/views/notifications/notifications-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { AlertsComponent } from './alerts.component'; 5 | import { BadgesComponent } from './badges.component'; 6 | import { ModalsComponent } from './modals.component'; 7 | 8 | const routes: Routes = [ 9 | { 10 | path: '', 11 | data: { 12 | title: 'Notifications' 13 | }, 14 | children: [ 15 | { 16 | path: 'alerts', 17 | component: AlertsComponent, 18 | data: { 19 | title: 'Alerts' 20 | } 21 | }, 22 | { 23 | path: 'badges', 24 | component: BadgesComponent, 25 | data: { 26 | title: 'Badges' 27 | } 28 | }, 29 | { 30 | path: 'modals', 31 | component: ModalsComponent, 32 | data: { 33 | title: 'Modals' 34 | } 35 | } 36 | ] 37 | } 38 | ]; 39 | 40 | @NgModule({ 41 | imports: [RouterModule.forChild(routes)], 42 | exports: [RouterModule] 43 | }) 44 | export class NotificationsRoutingModule {} 45 | -------------------------------------------------------------------------------- /AngularOIDC/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'), reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /VueJS/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 João José Paiva Bento Filho 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 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/unauthorized/unauthorized.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |

Unauthorized

10 |

You do not have access to this area.

11 |
12 |
13 |
14 |
15 |
16 |

Contact administrator

17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
-------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # jest test coverage 21 | .jest_coverage 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # built files 61 | dist -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/buttons/buttons-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { ButtonsComponent } from './buttons.component'; 5 | import { DropdownsComponent } from './dropdowns.component'; 6 | import { BrandButtonsComponent } from './brand-buttons.component'; 7 | 8 | const routes: Routes = [ 9 | { 10 | path: '', 11 | data: { 12 | title: 'Buttons' 13 | }, 14 | children: [ 15 | { 16 | path: 'buttons', 17 | component: ButtonsComponent, 18 | data: { 19 | title: 'Buttons' 20 | } 21 | }, 22 | { 23 | path: 'dropdowns', 24 | component: DropdownsComponent, 25 | data: { 26 | title: 'Dropdowns' 27 | } 28 | }, 29 | { 30 | path: 'brand-buttons', 31 | component: BrandButtonsComponent, 32 | data: { 33 | title: 'Brand buttons' 34 | } 35 | } 36 | ] 37 | } 38 | ]; 39 | 40 | @NgModule({ 41 | imports: [RouterModule.forChild(routes)], 42 | exports: [RouterModule] 43 | }) 44 | export class ButtonsRoutingModule {} 45 | -------------------------------------------------------------------------------- /AngularOIDC/src/scss/vendors/chart.js/chart.scss: -------------------------------------------------------------------------------- 1 | // Import variables 2 | @import '../variables'; 3 | 4 | .chart-legend, 5 | .bar-legend, 6 | .line-legend, 7 | .pie-legend, 8 | .radar-legend, 9 | .polararea-legend, 10 | .doughnut-legend { 11 | list-style-type: none; 12 | margin-top: 5px; 13 | text-align: center; 14 | -webkit-padding-start: 0; 15 | -moz-padding-start: 0; 16 | padding-left: 0; 17 | } 18 | .chart-legend li, 19 | .bar-legend li, 20 | .line-legend li, 21 | .pie-legend li, 22 | .radar-legend li, 23 | .polararea-legend li, 24 | .doughnut-legend li { 25 | display: inline-block; 26 | white-space: nowrap; 27 | position: relative; 28 | margin-bottom: 4px; 29 | @include border-radius($border-radius); 30 | padding: 2px 8px 2px 28px; 31 | font-size: smaller; 32 | cursor: default; 33 | } 34 | .chart-legend li span, 35 | .bar-legend li span, 36 | .line-legend li span, 37 | .pie-legend li span, 38 | .radar-legend li span, 39 | .polararea-legend li span, 40 | .doughnut-legend li span { 41 | display: block; 42 | position: absolute; 43 | left: 0; 44 | top: 0; 45 | width: 20px; 46 | height: 20px; 47 | @include border-radius($border-radius); 48 | } 49 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/theme/colors.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { getStyle, rgbToHex } from '@coreui/coreui/dist/js/coreui-utilities' 3 | 4 | @Component({ 5 | templateUrl: 'colors.component.html' 6 | }) 7 | export class ColorsComponent implements OnInit { 8 | public themeColors(): void { 9 | Array.from(document.querySelectorAll('.theme-color')).forEach(function(el) { 10 | let elem = document.getElementsByClassName(el.classList[0])[0]; 11 | let background = getStyle('background-color', elem); 12 | 13 | let table = document.createElement('table'); 14 | table.innerHTML = ` 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
HEX:${rgbToHex(background)}
RGB:${background}
25 | `; 26 | 27 | el.parentNode.appendChild(table); 28 | }); 29 | 30 | } 31 | 32 | ngOnInit(): void { 33 | this.themeColors(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /VueJS/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # jest test coverage 21 | .jest_coverage 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # built files 61 | dist -------------------------------------------------------------------------------- /AngularOIDC/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

4 | Welcome to {{ title }}! 5 |

6 | Angular Logo 7 |
8 |

Here are some links to help you start:

9 | 20 | 21 | -------------------------------------------------------------------------------- /VueJS/src/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Vue from 'vue' 3 | import VueRouter from 'vue-router'; 4 | import router from './router' 5 | import App from './App' 6 | import 'bootstrap' 7 | import 'bootstrap/dist/css/bootstrap.min.css' 8 | import Mgr from './services/SecurityService'; 9 | 10 | Vue.use(VueRouter); 11 | let mgr = new Mgr(); 12 | 13 | new Vue({ 14 | el: '#app', 15 | router, 16 | render: h => h(App) 17 | }) 18 | 19 | router.beforeEach((to, from, next) => { 20 | const requiresAuth = to.matched.some(record => record.meta.requiresAuth); 21 | const checkRole = to.matched.some(record => record.meta.role != null && record.meta.role.length > 0); 22 | if (requiresAuth) { 23 | 24 | if (checkRole) { 25 | mgr.getRole().then( 26 | sucess => { 27 | if (to.meta.role == sucess) { 28 | next(); 29 | } else { 30 | next('/accessdenied'); 31 | } 32 | }, 33 | err => { 34 | console.log(err); 35 | } 36 | ); 37 | } else { 38 | 39 | mgr.getSignedIn().then(sucess => { 40 | if (sucess) { 41 | next(); 42 | } else { 43 | next('/accessdenied'); 44 | } 45 | }, 46 | err => { 47 | console.log(err); 48 | }); 49 | } 50 | 51 | } else { 52 | next(); 53 | } 54 | }); 55 | -------------------------------------------------------------------------------- /Angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouterModule } from '@angular/router'; 4 | 5 | import { AppMenuComponent } from './app-menu.component'; 6 | import { AppComponent } from './app.component'; 7 | import { FallbackComponent } from './fallback.component'; 8 | import { ShouldLoginComponent } from './should-login.component'; 9 | import { SSOModule } from './sso/sso.module'; 10 | 11 | @NgModule({ 12 | declarations: [ 13 | AppComponent, 14 | AppMenuComponent, 15 | FallbackComponent, 16 | ShouldLoginComponent, 17 | ], 18 | imports: [ 19 | BrowserModule, 20 | SSOModule.forRoot(), 21 | RouterModule.forRoot([ 22 | { path: '', redirectTo: 'basics/home', pathMatch: 'full' }, 23 | 24 | // Note: this way of module loading requires this in your tsconfig.json: "module": "esnext" 25 | { path: 'basics', loadChildren: () => import('./feature-basics/basics.module').then(m => m.BasicsModule) }, 26 | { path: 'extras', loadChildren: () => import('./feature-extras/extras.module').then(m => m.ExtrasModule) }, 27 | 28 | { path: 'should-login', component: ShouldLoginComponent }, 29 | { path: '**', component: FallbackComponent }, 30 | ]) 31 | ], 32 | bootstrap: [AppComponent] 33 | }) 34 | export class AppModule { } 35 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/icons/icons-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { CoreUIIconsComponent } from './coreui-icons.component'; 5 | import { FlagsComponent } from './flags.component'; 6 | import { FontAwesomeComponent } from './font-awesome.component'; 7 | import { SimpleLineIconsComponent } from './simple-line-icons.component'; 8 | 9 | const routes: Routes = [ 10 | { 11 | path: '', 12 | data: { 13 | title: 'Icons' 14 | }, 15 | children: [ 16 | { 17 | path: 'coreui-icons', 18 | component: CoreUIIconsComponent, 19 | data: { 20 | title: 'CoreUI Icons' 21 | } 22 | }, 23 | { 24 | path: 'flags', 25 | component: FlagsComponent, 26 | data: { 27 | title: 'Flags' 28 | } 29 | }, 30 | { 31 | path: 'font-awesome', 32 | component: FontAwesomeComponent, 33 | data: { 34 | title: 'Font Awesome' 35 | } 36 | }, 37 | { 38 | path: 'simple-line-icons', 39 | component: SimpleLineIconsComponent, 40 | data: { 41 | title: 'Simple Line Icons' 42 | } 43 | } 44 | ] 45 | } 46 | ]; 47 | 48 | @NgModule({ 49 | imports: [RouterModule.forChild(routes)], 50 | exports: [RouterModule] 51 | }) 52 | export class IconsRoutingModule {} 53 | -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/brand/sygnet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/login/login.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |

Login

10 |

Sign In to your account

11 |
12 |
13 | 14 |
15 |
16 | 17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |

Sign up

25 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

26 | 27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | -------------------------------------------------------------------------------- /Angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample-auth-guards", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "^8.2.1", 15 | "@angular/common": "^8.2.1", 16 | "@angular/compiler": "^8.2.1", 17 | "@angular/core": "^8.2.1", 18 | "@angular/forms": "^8.2.1", 19 | "@angular/http": "^7.2.15", 20 | "@angular/platform-browser": "^8.2.1", 21 | "@angular/platform-browser-dynamic": "^8.2.1", 22 | "@angular/router": "^8.2.1", 23 | "angular-oauth2-oidc": "^8.0.4", 24 | "core-js": "^2.5.4", 25 | "rxjs": "^6.5.2", 26 | "zone.js": "^0.9.1" 27 | }, 28 | "devDependencies": { 29 | "@angular/compiler-cli": "^8.2.1", 30 | "@angular-devkit/build-angular": "~0.802.1", 31 | "@angular/cli": "~8.2.1", 32 | "@angular/language-service": "^8.2.1", 33 | "@types/jasmine": "~3.3.8", 34 | "@types/jasminewd2": "~2.0.3", 35 | "@types/node": "~8.9.4", 36 | "codelyzer": "~5.1.0", 37 | "jasmine-core": "~3.4.0", 38 | "jasmine-spec-reporter": "~4.2.1", 39 | "karma": "~4.1.0", 40 | "karma-chrome-launcher": "~2.2.0", 41 | "karma-coverage-istanbul-reporter": "~2.0.1", 42 | "karma-jasmine": "~2.0.1", 43 | "karma-jasmine-html-reporter": "^1.4.0", 44 | "protractor": "~5.4.0", 45 | "ts-node": "~7.0.0", 46 | "tslint": "~5.15.0", 47 | "typescript": "~3.5.3" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Angular/src/app/sso/sso.module.ts: -------------------------------------------------------------------------------- 1 | import { HttpClientModule } from '@angular/common/http'; 2 | import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core'; 3 | import { AuthConfig, JwksValidationHandler, OAuthModule, OAuthModuleConfig, OAuthStorage, ValidationHandler } from 'angular-oauth2-oidc'; 4 | 5 | import { authConfig } from './auth-config'; 6 | import { AuthGuardWithForcedLogin } from './auth-guard-with-forced-login.service'; 7 | import { AuthGuard } from './auth-guard.service'; 8 | import { authModuleConfig } from './auth-module-config'; 9 | import { AuthService } from './auth.service'; 10 | 11 | // We need a factory since localStorage is not available at AOT build time 12 | export function storageFactory() : OAuthStorage { 13 | return localStorage 14 | } 15 | 16 | @NgModule({ 17 | imports: [ 18 | HttpClientModule, 19 | OAuthModule.forRoot(), 20 | ], 21 | providers: [ 22 | AuthService, 23 | AuthGuard, 24 | AuthGuardWithForcedLogin, 25 | ], 26 | }) 27 | export class SSOModule { 28 | static forRoot(): ModuleWithProviders { 29 | return { 30 | ngModule: SSOModule, 31 | providers: [ 32 | { provide: AuthConfig, useValue: authConfig }, 33 | { provide: OAuthModuleConfig, useValue: authModuleConfig }, 34 | { provide: ValidationHandler, useClass: JwksValidationHandler }, 35 | { provide: OAuthStorage, useFactory: storageFactory }, 36 | ] 37 | }; 38 | } 39 | 40 | constructor (@Optional() @SkipSelf() parentModule: SSOModule) { 41 | if (parentModule) { 42 | throw new Error('Oauth2Module is already loaded. Import it in the AppModule only'); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/core/core.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Optional, SkipSelf, ModuleWithProviders } from "@angular/core"; 2 | 3 | import { throwIfAlreadyLoaded } from "./module-import-guard"; 4 | import { AuthGuardWithForcedLogin } from "./auth/auth-guard-with-forced-login.service"; 5 | import { AuthService } from "./auth/auth.service"; 6 | import { OAuthModule, AuthConfig, OAuthModuleConfig, ValidationHandler, JwksValidationHandler, OAuthStorage } from "angular-oauth2-oidc"; 7 | import { HttpClientModule } from "@angular/common/http"; 8 | import { authModuleConfig } from "./auth/auth-module-config"; 9 | import { AuthGuard } from "./auth/auth-guard.service"; 10 | import { authConfig } from "./auth/auth-config"; 11 | 12 | export function storageFactory(): OAuthStorage { 13 | return localStorage; 14 | } 15 | 16 | 17 | @NgModule({ 18 | imports: [ 19 | HttpClientModule, 20 | OAuthModule.forRoot(), 21 | ], 22 | providers: [ 23 | AuthService, 24 | AuthGuard, 25 | AuthGuardWithForcedLogin, 26 | ], 27 | declarations: [ 28 | ], 29 | exports: [ 30 | ] 31 | }) 32 | export class CoreModule { 33 | static forRoot(): ModuleWithProviders { 34 | return { 35 | ngModule: CoreModule, 36 | providers: [ 37 | { provide: AuthConfig, useValue: authConfig }, 38 | { provide: OAuthModuleConfig, useValue: authModuleConfig }, 39 | { provide: ValidationHandler, useClass: JwksValidationHandler }, 40 | { provide: OAuthStorage, useFactory: storageFactory }, 41 | ] 42 | }; 43 | } 44 | 45 | constructor(@Optional() @SkipSelf() parentModule: CoreModule) { 46 | throwIfAlreadyLoaded(parentModule, "CoreModule"); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Angular/README.md: -------------------------------------------------------------------------------- 1 | # Example angular-oauth2-oidc with AuthGuard 2 | 3 | This repository shows a basic Angular CLI application with [the `angular-oauth2-oidc` library](https://github.com/manfredsteyer/angular-oauth2-oidc) and Angular AuthGuards. 4 | 5 | ## Features 6 | 7 | This demonstrates: 8 | 9 | - Use of **the Implicit Flow** 10 | - Modules (core, shared, and two feature modules) 11 | - An auth guard that forces you to login when navigating to protected routes 12 | - An auth guard that just prevents you from navigating to protected routes 13 | - Asynchronous loading of login information (and thus async auth guards) 14 | - Using `localStorage` for storing tokens (use at your own risk!) 15 | - Loading IDS details from its discovery document 16 | - Trying silent refresh on app startup before potientially starting a login flow 17 | - OpenID's external logout features 18 | 19 | Most interesting features can be found in [the core module](./src/app/core). 20 | 21 | ## Usage 22 | 23 | This repository has been scaffolded with the Angular 5 CLI, then later upgraded to newer versions of the Angular CLI. 24 | To use the repository: 25 | 26 | 1. Clone this repository 27 | 1. Run `npm install` to get the dependencies 28 | 1. Run `ng serve --open` to get it running on [http://localhost:4200](http://localhost:4200) 29 | 30 | This connects to the IdentityServer also used in the library's example. 31 | The **credentials** are user "`max`" and password "`geheim`". 32 | 33 | You could also connect to your own IdentityServer by changing `auth-config.ts`. 34 | Note that your server must whitelist both `http://localhost:4200/index.html` and `http://localhost:4200/silent-refresh.html` for this to work. 35 | 36 | ## Example 37 | 38 | The application is supposed to look somewhat like this: 39 | 40 | ![Application Screenshot](screenshot-001.png) 41 | -------------------------------------------------------------------------------- /Angular/src/app/app-menu.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | 4 | import { AuthService } from './sso/auth.service'; 5 | 6 | @Component({ 7 | selector: 'app-menu', 8 | template: ``, 33 | }) 34 | export class AppMenuComponent { 35 | isAuthenticated: Observable; 36 | 37 | constructor(private authService: AuthService) { 38 | this.isAuthenticated = authService.isAuthenticated$; 39 | } 40 | 41 | login() { this.authService.login(); } 42 | logout() { this.authService.logout(); } 43 | 44 | get email() { 45 | return this.authService.identityClaims 46 | ? this.authService.identityClaims['email'] 47 | : '-'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/progress.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnDestroy} from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'progress.component.html' 5 | }) 6 | export class ProgressComponent implements OnDestroy { 7 | 8 | max: number = 200; 9 | showWarning: boolean; 10 | dynamic: number; 11 | type: string; 12 | 13 | constructor() { 14 | this.random(); 15 | this.randomStacked() 16 | } 17 | 18 | ngOnDestroy() { 19 | if (this.timer) { 20 | clearInterval(this.timer) 21 | } 22 | // console.log(`onDestroy`, this.timer); 23 | } 24 | 25 | random(): void { 26 | let value = Math.floor(Math.random() * 100 + 1); 27 | let type: string; 28 | 29 | if (value < 25) { 30 | type = 'success'; 31 | } else if (value < 50) { 32 | type = 'info'; 33 | } else if (value < 75) { 34 | type = 'warning'; 35 | } else { 36 | type = 'danger'; 37 | } 38 | 39 | this.showWarning = type === 'danger' || type === 'warning'; 40 | this.dynamic = value; 41 | this.type = type; 42 | 43 | } 44 | 45 | stacked: any[] = []; 46 | 47 | randomStacked(): void { 48 | let types = ['success', 'info', 'warning', 'danger']; 49 | 50 | this.stacked = []; 51 | let n = Math.floor(Math.random() * 4 + 1); 52 | for (let i = 0; i < n; i++) { 53 | let index = Math.floor(Math.random() * 4); 54 | let value = Math.floor(Math.random() * 27 + 3); 55 | this.stacked.push({ 56 | value, 57 | type: types[index], 58 | label: value + ' %' 59 | }); 60 | } 61 | } 62 | 63 | timer: any = null; 64 | buttonCaption: string = 'Start'; 65 | 66 | randomize(): void { 67 | if (this.timer) { 68 | clearInterval(this.timer); 69 | this.timer = null; 70 | } else { 71 | this.timer = setInterval(() => this.randomStacked(), 2000); 72 | } 73 | this.buttonCaption = this.timer ? 'Stop' : 'Start'; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/register/register.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |

Register

9 |

Create your account

10 |
11 |
12 | 13 |
14 | 15 |
16 |
17 |
18 | @ 19 |
20 | 21 |
22 |
23 |
24 | 25 |
26 | 27 |
28 |
29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 | 46 |
47 |
48 |
49 |
50 |
51 |
52 | -------------------------------------------------------------------------------- /VueJS/build/webpack.config.base.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const HtmlWebpackPlugin = require('html-webpack-plugin') 4 | const CopyWebpackPlugin = require('copy-webpack-plugin') 5 | const { VueLoaderPlugin } = require('vue-loader') 6 | 7 | const utils = require('./utils') 8 | 9 | module.exports = { 10 | resolve: { 11 | extensions: ['.js', '.vue', '.json'], 12 | alias: { 13 | 'assets': utils.resolve('assets'), 14 | 'pages': utils.resolve('src/pages'), 15 | 'static': utils.resolve('static'), 16 | 'components': utils.resolve('src/components'), 17 | 'router': utils.resolve('src/router'), 18 | 'services': utils.resolve('src/services') 19 | } 20 | }, 21 | entry: [ 22 | './src/index.js' 23 | ], 24 | module: { 25 | rules: [ 26 | { 27 | test: /\.(js|vue)$/, 28 | use: 'eslint-loader', 29 | enforce: 'pre' 30 | }, { 31 | test: /\.vue$/, 32 | use: 'vue-loader' 33 | }, { 34 | test: /\.js$/, 35 | use: { 36 | loader: 'babel-loader', 37 | } 38 | }, { 39 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 40 | use: { 41 | loader: 'url-loader', 42 | options: { 43 | limit: 10000, 44 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 45 | } 46 | } 47 | }, { 48 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 49 | use: { 50 | loader: 'url-loader', 51 | options: { 52 | limit: 10000, 53 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 54 | } 55 | } 56 | }, { 57 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 58 | use: { 59 | loader: 'url-loader', 60 | options: { 61 | limit: 10000, 62 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 63 | } 64 | } 65 | } 66 | ] 67 | }, 68 | 69 | plugins: [ 70 | new HtmlWebpackPlugin({ 71 | filename: 'index.html', 72 | template: 'index.html', 73 | inject: true 74 | }), 75 | new VueLoaderPlugin(), 76 | new CopyWebpackPlugin([ 77 | { 78 | from: utils.resolve('static/img'), 79 | to: utils.resolve('dist/static/img'), 80 | toType: 'dir' 81 | }, 82 | { 83 | from: utils.resolve('static'), 84 | to: utils.resolve('dist/static'), 85 | toType: 'dir' 86 | } 87 | ]) 88 | ] 89 | } -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/base.module.ts: -------------------------------------------------------------------------------- 1 | // Angular 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { NgModule } from '@angular/core'; 5 | 6 | import { CardsComponent } from './cards.component'; 7 | 8 | // Forms Component 9 | import { FormsComponent } from './forms.component'; 10 | 11 | import { SwitchesComponent } from './switches.component'; 12 | import { TablesComponent } from './tables.component'; 13 | 14 | // Tabs Component 15 | import { TabsModule } from 'ngx-bootstrap/tabs'; 16 | import { TabsComponent } from './tabs.component'; 17 | 18 | // Carousel Component 19 | import { CarouselModule } from 'ngx-bootstrap/carousel'; 20 | import { CarouselsComponent } from './carousels.component'; 21 | 22 | // Collapse Component 23 | import { CollapseModule } from 'ngx-bootstrap/collapse'; 24 | import { CollapsesComponent } from './collapses.component'; 25 | 26 | // Dropdowns Component 27 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; 28 | 29 | // Pagination Component 30 | import { PaginationModule } from 'ngx-bootstrap/pagination'; 31 | import { PopoversComponent } from './popovers.component'; 32 | 33 | // Popover Component 34 | import { PopoverModule } from 'ngx-bootstrap/popover'; 35 | import { PaginationsComponent } from './paginations.component'; 36 | 37 | // Progress Component 38 | import { ProgressbarModule } from 'ngx-bootstrap/progressbar'; 39 | import { ProgressComponent } from './progress.component'; 40 | 41 | // Tooltip Component 42 | import { TooltipModule } from 'ngx-bootstrap/tooltip'; 43 | import { TooltipsComponent } from './tooltips.component'; 44 | 45 | 46 | // Components Routing 47 | import { BaseRoutingModule } from './base-routing.module'; 48 | 49 | @NgModule({ 50 | imports: [ 51 | CommonModule, 52 | FormsModule, 53 | BaseRoutingModule, 54 | BsDropdownModule.forRoot(), 55 | TabsModule, 56 | CarouselModule.forRoot(), 57 | CollapseModule.forRoot(), 58 | PaginationModule.forRoot(), 59 | PopoverModule.forRoot(), 60 | ProgressbarModule.forRoot(), 61 | TooltipModule.forRoot() 62 | ], 63 | declarations: [ 64 | CardsComponent, 65 | FormsComponent, 66 | SwitchesComponent, 67 | TablesComponent, 68 | TabsComponent, 69 | CarouselsComponent, 70 | CollapsesComponent, 71 | PaginationsComponent, 72 | PopoversComponent, 73 | ProgressComponent, 74 | TooltipsComponent 75 | ] 76 | }) 77 | export class BaseModule { } 78 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/progress.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Bootstrap Progress 5 | 10 |
11 |
12 |
13 |
14 | 15 |
16 |
17 | 22% 18 |
19 |
20 | 166 / 200 21 |
22 |
23 |
24 |
25 |
26 |
27 | Progress dynamic 28 |
29 |
30 | 31 | {{dynamic}} / {{max}} 32 | 33 | 34 | No animation 35 | {{dynamic}}% 36 | 37 | Object (changes type based on value) 38 | 39 | {{type}} !!! Watch out !!! 40 | 41 |
42 | 43 |
44 |
45 |
46 |
47 | Progress stacked 48 |
49 |
50 |
51 | 52 |
53 |
54 |
55 | 56 |
57 |
58 |
59 |
60 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; 4 | import { LocationStrategy, HashLocationStrategy } from '@angular/common'; 5 | import { OAuthModule, AuthConfig } from 'angular-oauth2-oidc'; 6 | import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; 7 | import { PERFECT_SCROLLBAR_CONFIG } from 'ngx-perfect-scrollbar'; 8 | import { PerfectScrollbarConfigInterface } from 'ngx-perfect-scrollbar'; 9 | 10 | const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { 11 | suppressScrollX: true 12 | }; 13 | 14 | import { AppComponent } from './app.component'; 15 | 16 | // Import containers 17 | import { DefaultLayoutComponent } from './containers'; 18 | 19 | import { P404Component } from './views/error/404.component'; 20 | import { P500Component } from './views/error/500.component'; 21 | import { LoginComponent } from './views/login/login.component'; 22 | import { RegisterComponent } from './views/register/register.component'; 23 | import { UnauthorizedComponent } from './views/unauthorized/unauthorized.component'; 24 | import { LoginCallbackComponent } from './views/login/login-callback.component'; 25 | 26 | const APP_CONTAINERS = [ 27 | DefaultLayoutComponent 28 | ]; 29 | 30 | import { 31 | AppAsideModule, 32 | AppBreadcrumbModule, 33 | AppHeaderModule, 34 | AppFooterModule, 35 | AppSidebarModule, 36 | } from '@coreui/angular' 37 | 38 | // Import routing module 39 | import { AppRoutingModule } from './app.routing'; 40 | 41 | // Import 3rd party components 42 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; 43 | import { TabsModule } from 'ngx-bootstrap/tabs'; 44 | import { ChartsModule } from 'ng2-charts/ng2-charts'; 45 | import { CoreModule } from './core/core.module'; 46 | 47 | 48 | @NgModule({ 49 | imports: [ 50 | BrowserModule, 51 | HttpClientModule, 52 | CoreModule.forRoot(), 53 | AppRoutingModule, 54 | AppAsideModule, 55 | AppBreadcrumbModule.forRoot(), 56 | AppFooterModule, 57 | AppHeaderModule, 58 | AppSidebarModule, 59 | PerfectScrollbarModule, 60 | BsDropdownModule.forRoot(), 61 | TabsModule.forRoot(), 62 | ChartsModule, 63 | ], 64 | declarations: [ 65 | AppComponent, 66 | ...APP_CONTAINERS, 67 | P404Component, 68 | P500Component, 69 | LoginComponent, 70 | RegisterComponent, 71 | UnauthorizedComponent, // -- Feature from this project 72 | LoginCallbackComponent // -- Feature from this project 73 | ], 74 | bootstrap: [AppComponent] 75 | }) 76 | export class AppModule { } 77 | -------------------------------------------------------------------------------- /VueJS/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuejsoidcclient", 3 | "version": "1.0.0", 4 | "description": "project vueJs with oidc-client library", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "webpack-dev-server --progress --config build/webpack.config.dev.js", 8 | "prod": "webpack --config build/webpack.config.prod.js", 9 | "lint": "eslint --ext .js,.vue src", 10 | "lint:fix": "eslint --ext .js,.vue src --fix", 11 | "test": "jest" 12 | }, 13 | "author": "joaojosefilho ", 14 | "license": "MIT", 15 | "dependencies": { 16 | "@babel/polyfill": "^7.2.5", 17 | "axios": "^0.18.0", 18 | "babel-polyfill": "^6.26.0", 19 | "bootstrap": "^4.2.1", 20 | "jquery": "^3.3.1", 21 | "oidc-client": "^1.6.1", 22 | "popper.js": "^1.14.6", 23 | "vue": "^2.5.22", 24 | "vue-router": "^3.0.2" 25 | }, 26 | "devDependencies": { 27 | "@babel/core": "^7.2.2", 28 | "@babel/preset-env": "^7.2.3", 29 | "@vue/test-utils": "^1.0.0-beta.28", 30 | "babel-core": "^7.0.0-bridge.0", 31 | "babel-eslint": "^10.0.1", 32 | "babel-jest": "^23.6.0", 33 | "babel-loader": "^8.0.5", 34 | "copy-webpack-plugin": "^4.6.0", 35 | "css-loader": "^1.0.1", 36 | "eslint": "^5.12.0", 37 | "eslint-config-standard": "^12.0.0", 38 | "eslint-loader": "^2.1.1", 39 | "eslint-plugin-import": "^2.14.0", 40 | "eslint-plugin-node": "^8.0.1", 41 | "eslint-plugin-promise": "^4.0.1", 42 | "eslint-plugin-standard": "^4.0.0", 43 | "eslint-plugin-vue": "^4.7.1", 44 | "html-webpack-plugin": "^3.2.0", 45 | "jest": "^23.6.0", 46 | "jest-serializer-vue": "^2.0.2", 47 | "mini-css-extract-plugin": "^0.4.5", 48 | "stylus": "^0.54.5", 49 | "stylus-loader": "^3.0.2", 50 | "uglify-es": "^3.3.9", 51 | "url-loader": "^1.1.2", 52 | "vue-jest": "^3.0.2", 53 | "vue-loader": "^15.5.1", 54 | "vue-server-renderer": "^2.5.22", 55 | "vue-style-loader": "^4.1.2", 56 | "vue-template-compiler": "^2.5.22", 57 | "webpack": "^4.28.4", 58 | "webpack-cli": "^3.2.1", 59 | "webpack-dev-server": "^3.1.14", 60 | "webpack-merge": "^4.2.1" 61 | }, 62 | "jest": { 63 | "collectCoverage": true, 64 | "collectCoverageFrom": [ 65 | "src/**/*.{js,vue}" 66 | ], 67 | "coverageDirectory": ".jest_coverage", 68 | "moduleFileExtensions": [ 69 | "js", 70 | "vue" 71 | ], 72 | "moduleNameMapper": { 73 | "^@/(.*)$": "/src/$1" 74 | }, 75 | "transform": { 76 | "^.+\\.js$": "babel-jest", 77 | "^.+\\.vue$": "vue-jest" 78 | }, 79 | "snapshotSerializers": [ 80 | "/node_modules/jest-serializer-vue" 81 | ] 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/notifications/alerts.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, SecurityContext, ViewEncapsulation } from '@angular/core'; 2 | import { DomSanitizer } from '@angular/platform-browser'; 3 | import { AlertConfig } from 'ngx-bootstrap/alert'; 4 | 5 | // such override allows to keep some initial values 6 | 7 | export function getAlertConfig(): AlertConfig { 8 | return Object.assign(new AlertConfig(), { type: 'success' }); 9 | } 10 | 11 | @Component({ 12 | templateUrl: 'alerts.component.html', 13 | encapsulation: ViewEncapsulation.None, 14 | styles: [ 15 | ` 16 | .alert-md-local { 17 | background-color: #009688; 18 | border-color: #00695C; 19 | color: #fff; 20 | } 21 | ` 22 | ], 23 | providers: [{ provide: AlertConfig, useFactory: getAlertConfig }] 24 | }) 25 | export class AlertsComponent { 26 | 27 | constructor(sanitizer: DomSanitizer) { 28 | this.alertsHtml = this.alertsHtml.map((alert: any) => ({ 29 | type: alert.type, 30 | msg: sanitizer.sanitize(SecurityContext.HTML, alert.msg) 31 | })); 32 | } 33 | dismissible = true; 34 | alerts: any = [ 35 | { 36 | type: 'success', 37 | msg: `You successfully read this important alert message.` 38 | }, 39 | { 40 | type: 'info', 41 | msg: `This alert needs your attention, but it's not super important.` 42 | }, 43 | { 44 | type: 'danger', 45 | msg: `Better check yourself, you're not looking too good.` 46 | } 47 | ]; 48 | 49 | reset(): void { 50 | this.alerts = this.alerts.map((alert: any) => Object.assign({}, alert)); 51 | } 52 | 53 | alertsHtml: any = [ 54 | { 55 | type: 'success', 56 | msg: `Well done! You successfully read this important alert message.` 57 | }, 58 | { 59 | type: 'info', 60 | msg: `Heads up! This alert needs your attention, but it's not super important.` 61 | }, 62 | { 63 | type: 'danger', 64 | msg: `Warning! Better check yourself, you're not looking too good.` 65 | } 66 | ]; 67 | 68 | index = 0; 69 | messages = [ 70 | 'You successfully read this important alert message.', 71 | 'Now this text is different from what it was before. Go ahead and click the button one more time', 72 | 'Well done! Click reset button and you\'ll see the first message' 73 | ]; 74 | 75 | changeText() { 76 | if (this.messages.length - 1 !== this.index) { 77 | this.index++; 78 | } 79 | } 80 | 81 | alertsDismiss: any = []; 82 | 83 | add(): void { 84 | this.alertsDismiss.push({ 85 | type: 'info', 86 | msg: `This alert will be closed in 5 seconds (added: ${new Date().toLocaleTimeString()})`, 87 | timeout: 5000 88 | }); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /AngularOIDC/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@coreui/coreui-free-angular-admin-template", 3 | "version": "2.0.0-rc.2", 4 | "description": "CoreUI Free Angular 2+ Admin Template", 5 | "author": { 6 | "name": "Łukasz Holeczek", 7 | "url": "http://holeczek.pl", 8 | "github": "https://github.com/mrholek", 9 | "twitter": "https://twitter.com/lukaszholeczek" 10 | }, 11 | "contributors": [ 12 | { 13 | "name": "Andrzej Kopański", 14 | "url": "https://github.com/xidedix" 15 | } 16 | ], 17 | "homepage": "https://coreui.io/angular", 18 | "copyright": "Copyright 2018 creativeLabs Łukasz Holeczek", 19 | "license": "MIT", 20 | "scripts": { 21 | "ng": "ng", 22 | "start": "ng serve", 23 | "build": "ng build --prod", 24 | "test": "ng test", 25 | "lint": "ng lint", 26 | "e2e": "ng e2e" 27 | }, 28 | "private": true, 29 | "dependencies": { 30 | "@angular/animations": "^6.0.9", 31 | "@angular/common": "^6.0.9", 32 | "@angular/compiler": "^6.0.9", 33 | "@angular/core": "^6.0.9", 34 | "@angular/forms": "^6.0.9", 35 | "@angular/http": "^6.0.9", 36 | "@angular/platform-browser": "^6.0.9", 37 | "@angular/platform-browser-dynamic": "^6.0.9", 38 | "@angular/router": "^6.0.9", 39 | "@coreui/angular": "^2.0.0-rc.1", 40 | "@coreui/coreui": "^2.0.4", 41 | "@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.2.0", 42 | "@coreui/icons": "^0.3.0", 43 | "angular-oauth2-oidc": "^4.0.2", 44 | "bootstrap": "^4.1.2", 45 | "chart.js": "^2.7.2", 46 | "core-js": "^2.5.7", 47 | "flag-icon-css": "^3.0.0", 48 | "font-awesome": "^4.7.0", 49 | "moment": "^2.22.2", 50 | "mutationobserver-shim": "^0.3.2", 51 | "ng2-charts": "^1.6.0", 52 | "ngx-bootstrap": "^3.0.1", 53 | "ngx-perfect-scrollbar": "^6.2.0", 54 | "rxjs": "^6.2.1", 55 | "rxjs-compat": "^6.2.1", 56 | "simple-line-icons": "^2.4.1", 57 | "ts-helpers": "^1.1.2", 58 | "zone.js": "^0.8.26" 59 | }, 60 | "devDependencies": { 61 | "@angular-devkit/build-angular": "^0.6.8", 62 | "@angular/cli": "^6.0.8", 63 | "@angular/compiler-cli": "^6.0.9", 64 | "@angular/language-service": "^6.0.9", 65 | "@types/jasmine": "^2.8.8", 66 | "@types/jasminewd2": "^2.0.3", 67 | "@types/node": "^10.3.4", 68 | "codelyzer": "^4.4.2", 69 | "jasmine-core": "^3.1.0", 70 | "jasmine-spec-reporter": "^4.2.1", 71 | "karma": "^2.0.3", 72 | "karma-chrome-launcher": "^2.2.0", 73 | "karma-coverage-istanbul-reporter": "^2.0.1", 74 | "karma-jasmine": "^1.1.2", 75 | "karma-jasmine-html-reporter": "^1.2.0", 76 | "protractor": "^5.3.2", 77 | "ts-node": "^6.1.1", 78 | "tslint": "^5.10.0", 79 | "typescript": "2.7.2" 80 | }, 81 | "engines": { 82 | "node": ">= 8.9.4", 83 | "npm": ">= 5.6.0" 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/app.routing.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | // Import Containers 5 | import { DefaultLayoutComponent } from './containers'; 6 | 7 | import { P404Component } from './views/error/404.component'; 8 | import { P500Component } from './views/error/500.component'; 9 | import { LoginComponent } from './views/login/login.component'; 10 | import { RegisterComponent } from './views/register/register.component'; 11 | import { UnauthorizedComponent } from './views/unauthorized/unauthorized.component'; 12 | import { LoginCallbackComponent } from './views/login/login-callback.component'; 13 | import { AuthGuard } from './core/auth/auth-guard.service'; 14 | 15 | export const routes: Routes = [ 16 | { path: '', redirectTo: 'login', pathMatch: 'full', }, 17 | { 18 | path: '404', 19 | component: P404Component, 20 | data: { 21 | title: 'Page 404' 22 | } 23 | }, 24 | { 25 | path: '500', 26 | component: P500Component, 27 | data: { 28 | title: 'Page 500' 29 | } 30 | }, 31 | { 32 | path: 'login', 33 | component: LoginComponent, 34 | data: { 35 | title: 'Login Page' 36 | } 37 | }, 38 | { 39 | path: 'register', 40 | component: RegisterComponent, 41 | data: { 42 | title: 'Register Page' 43 | } 44 | }, 45 | { // -- Feature from this project 46 | path: 'login-callback', 47 | component: LoginCallbackComponent, 48 | data: { 49 | title: 'Login Page' 50 | } 51 | }, 52 | { // -- Feature from this project 53 | path: 'unauthorized', 54 | component: UnauthorizedComponent, 55 | data: { 56 | title: 'Unauthorized Page' 57 | } 58 | }, 59 | { 60 | path: '', 61 | component: DefaultLayoutComponent, 62 | canActivate: [AuthGuard], // -- Feature from this project 63 | data: { 64 | title: 'Home' 65 | }, 66 | children: [ 67 | { path: 'cotacao', loadChildren: './views/cotacao/cotacao.module#CotacaoModule' }, 68 | { path: 'base', loadChildren: './views/base/base.module#BaseModule' }, 69 | { path: 'buttons', loadChildren: './views/buttons/buttons.module#ButtonsModule' }, 70 | { path: 'charts', loadChildren: './views/chartjs/chartjs.module#ChartJSModule' }, 71 | { path: 'dashboard', loadChildren: './views/dashboard/dashboard.module#DashboardModule' }, 72 | { path: 'icons', loadChildren: './views/icons/icons.module#IconsModule' }, 73 | { path: 'notifications', loadChildren: './views/notifications/notifications.module#NotificationsModule' }, 74 | { path: 'theme', loadChildren: './views/theme/theme.module#ThemeModule' }, 75 | { path: 'widgets', loadChildren: './views/widgets/widgets.module#WidgetsModule' } 76 | ] 77 | } 78 | ]; 79 | 80 | @NgModule({ 81 | imports: [RouterModule.forRoot(routes)], 82 | providers: [AuthGuard], // -- AQUI 83 | exports: [RouterModule] 84 | }) 85 | export class AppRoutingModule { } 86 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/base-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { CardsComponent } from './cards.component'; 5 | import { FormsComponent } from './forms.component'; 6 | import { SwitchesComponent } from './switches.component'; 7 | import { TablesComponent } from './tables.component'; 8 | import { TabsComponent } from './tabs.component'; 9 | import { CarouselsComponent } from './carousels.component'; 10 | import { CollapsesComponent } from './collapses.component'; 11 | import { PaginationsComponent } from './paginations.component'; 12 | import {PopoversComponent} from './popovers.component'; 13 | import {ProgressComponent} from './progress.component'; 14 | import {TooltipsComponent} from './tooltips.component'; 15 | 16 | const routes: Routes = [ 17 | { 18 | path: '', 19 | data: { 20 | title: 'Base' 21 | }, 22 | children: [ 23 | { 24 | path: 'cards', 25 | component: CardsComponent, 26 | data: { 27 | title: 'Cards' 28 | } 29 | }, 30 | { 31 | path: 'forms', 32 | component: FormsComponent, 33 | data: { 34 | title: 'Forms' 35 | } 36 | }, 37 | { 38 | path: 'switches', 39 | component: SwitchesComponent, 40 | data: { 41 | title: 'Switches' 42 | } 43 | }, 44 | { 45 | path: 'tables', 46 | component: TablesComponent, 47 | data: { 48 | title: 'Tables' 49 | } 50 | }, 51 | { 52 | path: 'tabs', 53 | component: TabsComponent, 54 | data: { 55 | title: 'Tabs' 56 | } 57 | }, 58 | { 59 | path: 'carousels', 60 | component: CarouselsComponent, 61 | data: { 62 | title: 'Carousels' 63 | } 64 | }, 65 | { 66 | path: 'collapses', 67 | component: CollapsesComponent, 68 | data: { 69 | title: 'Collapses' 70 | } 71 | }, 72 | { 73 | path: 'paginations', 74 | component: PaginationsComponent, 75 | data: { 76 | title: 'Pagination' 77 | } 78 | }, 79 | { 80 | path: 'popovers', 81 | component: PopoversComponent, 82 | data: { 83 | title: 'Popover' 84 | } 85 | }, 86 | { 87 | path: 'progress', 88 | component: ProgressComponent, 89 | data: { 90 | title: 'Progress' 91 | } 92 | }, 93 | { 94 | path: 'tooltips', 95 | component: TooltipsComponent, 96 | data: { 97 | title: 'Tooltips' 98 | } 99 | } 100 | ] 101 | } 102 | ]; 103 | 104 | @NgModule({ 105 | imports: [RouterModule.forChild(routes)], 106 | exports: [RouterModule] 107 | }) 108 | export class BaseRoutingModule {} 109 | -------------------------------------------------------------------------------- /Angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | 4 | import { AuthService } from './sso/auth.service'; 5 | 6 | @Component({ 7 | selector: 'app-root', 8 | template: `
9 | 10 |
11 |

Welcome

12 |

This is part of the app.component. Below is the router outlet.

13 |
14 | 15 |
Authenticating...
16 |
17 |

You can go to a url without a route to see the fallback route.

18 |
19 |

20 | 21 | 22 | 23 |

24 |

25 | 26 | 27 | 28 |

29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
IsAuthenticated{{isAuthenticated | async}}
HasValidToken{{hasValidToken}}
IsDoneLoading{{isDoneLoading | async}}
CanActivateProtectedRoutes{{canActivateProtectedRoutes | async}}
IdentityClaims{{identityClaims | json}}
AccessToken{{accessToken}}
IdToken{{idToken}}
39 |
40 |
`, 41 | }) 42 | export class AppComponent { 43 | isAuthenticated: Observable; 44 | isDoneLoading: Observable; 45 | canActivateProtectedRoutes: Observable; 46 | 47 | constructor ( 48 | private authService: AuthService, 49 | ) { 50 | this.isAuthenticated = this.authService.isAuthenticated$; 51 | this.isDoneLoading = this.authService.isDoneLoading$; 52 | this.canActivateProtectedRoutes = this.authService.canActivateProtectedRoutes$; 53 | 54 | this.authService.runInitialLoginSequence(); 55 | } 56 | 57 | login() { this.authService.login(); } 58 | logout() { this.authService.logout(); } 59 | refresh() { this.authService.refresh(); } 60 | reload() { window.location.reload(); } 61 | clearStorage() { localStorage.clear(); } 62 | 63 | logoutExternally() { 64 | window.open(this.authService.logoutUrl); 65 | } 66 | 67 | get hasValidToken() { return this.authService.hasValidToken(); } 68 | get accessToken() { return this.authService.accessToken; } 69 | get identityClaims() { return this.authService.identityClaims; } 70 | get idToken() { return this.authService.idToken; } 71 | } 72 | -------------------------------------------------------------------------------- /AngularOIDC/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | import 'core-js/es6/symbol'; 23 | import 'core-js/es6/object'; 24 | import 'core-js/es6/function'; 25 | import 'core-js/es6/parse-int'; 26 | import 'core-js/es6/parse-float'; 27 | import 'core-js/es6/number'; 28 | import 'core-js/es6/math'; 29 | import 'core-js/es6/string'; 30 | import 'core-js/es6/date'; 31 | import 'core-js/es6/array'; 32 | import 'core-js/es6/regexp'; 33 | import 'core-js/es6/map'; 34 | import 'core-js/es6/weak-map'; 35 | import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | // for IE10 49 | import 'mutationobserver-shim' 50 | 51 | /** 52 | * Required to support Web Animations `@angular/platform-browser/animations`. 53 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 54 | **/ 55 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 56 | 57 | /** 58 | * By default, zone.js will patch all possible macroTask and DomEvents 59 | * user can disable parts of macroTask/DomEvents patch by setting following flags 60 | */ 61 | 62 | (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 63 | (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 64 | (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 65 | (window as any).__Zone_enable_cross_context_check = true; 66 | 67 | /* 68 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 69 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 70 | */ 71 | (window as any).__Zone_enable_cross_context_check = true; 72 | 73 | /*************************************************************************************************** 74 | * Zone JS is required by default for Angular itself. 75 | */ 76 | import 'zone.js/dist/zone'; // Included with Angular CLI. 77 | 78 | 79 | 80 | /*************************************************************************************************** 81 | * APPLICATION IMPORTS 82 | */ 83 | -------------------------------------------------------------------------------- /Angular/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Web Animations `@angular/platform-browser/animations` 51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 53 | **/ 54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 55 | 56 | /** 57 | * By default, zone.js will patch all possible macroTask and DomEvents 58 | * user can disable parts of macroTask/DomEvents patch by setting following flags 59 | */ 60 | 61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 64 | 65 | /* 66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 68 | */ 69 | // (window as any).__Zone_enable_cross_context_check = true; 70 | 71 | /*************************************************************************************************** 72 | * Zone JS is required by default for Angular itself. 73 | */ 74 | import 'zone.js/dist/zone'; // Included with Angular CLI. 75 | 76 | 77 | 78 | /*************************************************************************************************** 79 | * APPLICATION IMPORTS 80 | */ 81 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/chartjs/chartjs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: 'chartjs.component.html' 5 | }) 6 | export class ChartJSComponent { 7 | 8 | // lineChart 9 | public lineChartData: Array = [ 10 | {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'}, 11 | {data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'}, 12 | {data: [18, 48, 77, 9, 100, 27, 40], label: 'Series C'} 13 | ]; 14 | public lineChartLabels: Array = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; 15 | public lineChartOptions: any = { 16 | animation: false, 17 | responsive: true 18 | }; 19 | public lineChartColours: Array = [ 20 | { // grey 21 | backgroundColor: 'rgba(148,159,177,0.2)', 22 | borderColor: 'rgba(148,159,177,1)', 23 | pointBackgroundColor: 'rgba(148,159,177,1)', 24 | pointBorderColor: '#fff', 25 | pointHoverBackgroundColor: '#fff', 26 | pointHoverBorderColor: 'rgba(148,159,177,0.8)' 27 | }, 28 | { // dark grey 29 | backgroundColor: 'rgba(77,83,96,0.2)', 30 | borderColor: 'rgba(77,83,96,1)', 31 | pointBackgroundColor: 'rgba(77,83,96,1)', 32 | pointBorderColor: '#fff', 33 | pointHoverBackgroundColor: '#fff', 34 | pointHoverBorderColor: 'rgba(77,83,96,1)' 35 | }, 36 | { // grey 37 | backgroundColor: 'rgba(148,159,177,0.2)', 38 | borderColor: 'rgba(148,159,177,1)', 39 | pointBackgroundColor: 'rgba(148,159,177,1)', 40 | pointBorderColor: '#fff', 41 | pointHoverBackgroundColor: '#fff', 42 | pointHoverBorderColor: 'rgba(148,159,177,0.8)' 43 | } 44 | ]; 45 | public lineChartLegend = true; 46 | public lineChartType = 'line'; 47 | 48 | // barChart 49 | public barChartOptions: any = { 50 | scaleShowVerticalLines: false, 51 | responsive: true 52 | }; 53 | public barChartLabels: string[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; 54 | public barChartType = 'bar'; 55 | public barChartLegend = true; 56 | 57 | public barChartData: any[] = [ 58 | {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'}, 59 | {data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'} 60 | ]; 61 | 62 | // Doughnut 63 | public doughnutChartLabels: string[] = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; 64 | public doughnutChartData: number[] = [350, 450, 100]; 65 | public doughnutChartType = 'doughnut'; 66 | 67 | // Radar 68 | public radarChartLabels: string[] = ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running']; 69 | 70 | public radarChartData: any = [ 71 | {data: [65, 59, 90, 81, 56, 55, 40], label: 'Series A'}, 72 | {data: [28, 48, 40, 19, 96, 27, 100], label: 'Series B'} 73 | ]; 74 | public radarChartType = 'radar'; 75 | 76 | // Pie 77 | public pieChartLabels: string[] = ['Download Sales', 'In-Store Sales', 'Mail Sales']; 78 | public pieChartData: number[] = [300, 500, 100]; 79 | public pieChartType = 'pie'; 80 | 81 | // PolarArea 82 | public polarAreaChartLabels: string[] = ['Download Sales', 'In-Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales']; 83 | public polarAreaChartData: number[] = [300, 500, 100, 40, 120]; 84 | public polarAreaLegend = true; 85 | 86 | public polarAreaChartType = 'polarArea'; 87 | 88 | // events 89 | public chartClicked(e: any): void { 90 | console.log(e); 91 | } 92 | 93 | public chartHovered(e: any): void { 94 | console.log(e); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /Angular/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": true, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-unused-variable": true, 76 | "no-use-before-declare": true, 77 | "no-var-keyword": true, 78 | "object-literal-sort-keys": false, 79 | "one-line": [ 80 | true, 81 | "check-open-brace", 82 | "check-catch", 83 | "check-else", 84 | "check-whitespace" 85 | ], 86 | "ordered-imports": true, 87 | "prefer-const": true, 88 | "quotemark": [ 89 | true, 90 | "single" 91 | ], 92 | "radix": true, 93 | "semicolon": [ 94 | true, 95 | "always" 96 | ], 97 | "triple-equals": [ 98 | true, 99 | "allow-null-check" 100 | ], 101 | "typedef-whitespace": [ 102 | true, 103 | { 104 | "call-signature": "nospace", 105 | "index-signature": "nospace", 106 | "parameter": "nospace", 107 | "property-declaration": "nospace", 108 | "variable-declaration": "nospace" 109 | } 110 | ], 111 | "unified-signatures": true, 112 | "variable-name": false, 113 | "whitespace": [ 114 | true, 115 | "check-branch", 116 | "check-decl", 117 | "check-operator", 118 | "check-separator", 119 | "check-type" 120 | ], 121 | "no-output-on-prefix": true, 122 | "use-input-property-decorator": true, 123 | "use-output-property-decorator": true, 124 | "use-host-property-decorator": true, 125 | "no-input-rename": true, 126 | "no-output-rename": true, 127 | "use-life-cycle-interface": true, 128 | "use-pipe-transform-interface": true, 129 | "component-class-suffix": true, 130 | "directive-class-suffix": true 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /AngularOIDC/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": false, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": false, 31 | "member-access": false, 32 | "member-ordering": [ 33 | true, 34 | { 35 | "order": [ 36 | "static-field", 37 | "instance-field", 38 | "static-method", 39 | "instance-method" 40 | ] 41 | } 42 | ], 43 | "no-arg": true, 44 | "no-bitwise": true, 45 | "no-console": [ 46 | true, 47 | "debug", 48 | "info", 49 | "time", 50 | "timeEnd", 51 | "trace" 52 | ], 53 | "no-construct": true, 54 | "no-debugger": true, 55 | "no-duplicate-super": true, 56 | "no-empty": false, 57 | "no-empty-interface": true, 58 | "no-eval": true, 59 | "no-inferrable-types": [ 60 | true, 61 | "ignore-params" 62 | ], 63 | "no-misused-new": true, 64 | "no-non-null-assertion": true, 65 | "no-shadowed-variable": true, 66 | "no-string-literal": false, 67 | "no-string-throw": true, 68 | "no-switch-case-fall-through": true, 69 | "no-trailing-whitespace": true, 70 | "no-unnecessary-initializer": true, 71 | "no-unused-expression": true, 72 | "no-use-before-declare": true, 73 | "no-var-keyword": true, 74 | "object-literal-sort-keys": false, 75 | "one-line": [ 76 | true, 77 | "check-open-brace", 78 | "check-catch", 79 | "check-else", 80 | "check-whitespace" 81 | ], 82 | "prefer-const": true, 83 | "quotemark": false, 84 | "radix": true, 85 | "semicolon": [ 86 | true, 87 | "always" 88 | ], 89 | "triple-equals": [ 90 | true, 91 | "allow-null-check" 92 | ], 93 | "typedef-whitespace": [ 94 | true, 95 | { 96 | "call-signature": "nospace", 97 | "index-signature": "nospace", 98 | "parameter": "nospace", 99 | "property-declaration": "nospace", 100 | "variable-declaration": "nospace" 101 | } 102 | ], 103 | "unified-signatures": true, 104 | "variable-name": false, 105 | "whitespace": [ 106 | true, 107 | "check-branch", 108 | "check-decl", 109 | "check-operator", 110 | "check-separator", 111 | "check-type" 112 | ], 113 | "directive-selector": [ 114 | true, 115 | "attribute", 116 | "app", 117 | "camelCase" 118 | ], 119 | "component-selector": [ 120 | true, 121 | "element", 122 | "app", 123 | "kebab-case" 124 | ], 125 | "no-output-on-prefix": true, 126 | "use-input-property-decorator": true, 127 | "use-output-property-decorator": true, 128 | "use-host-property-decorator": true, 129 | "no-input-rename": true, 130 | "no-output-rename": true, 131 | "use-life-cycle-interface": true, 132 | "use-pipe-transform-interface": true, 133 | "component-class-suffix": true, 134 | "directive-class-suffix": true 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/paginations.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Bootstrap Pagination 5 | 10 |
11 |
12 |
13 |
14 | 15 |
16 |
17 | 19 |
20 |
21 | 23 |
24 |
25 | 27 |
28 |
29 |
The selected page no: {{currentPage}}/{{smallnumPages}}
30 |
31 | 34 |
35 |
36 |
37 | Pagination states & limits 38 |
39 |
40 |
41 |
42 | 44 |
45 | 46 |
47 | 50 |
51 |
52 |
Page: {{bigCurrentPage}} / {{numPages}}
53 |
54 |
55 |
56 |
57 | Pager 58 |
59 |
60 |
61 |
62 | 67 | 68 |
69 | 70 |
71 | 78 | 79 |
80 |
81 |
82 |
83 |
84 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/notifications/badges.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | Bootstrap Badges 7 | 12 |
13 |
14 |

Example heading 15 | New 16 |

17 |

Example heading 18 | New 19 |

20 |

Example heading 21 | New 22 |

23 |

Example heading 24 | New 25 |

26 |
Example heading 27 | New 28 |
29 |
Example heading 30 | New 31 |
32 |
33 | 38 |
39 |
40 |
41 |
42 |
43 | Bootstrap Badges 44 | contextual variations 45 |
46 |
47 | Primary 48 | Secondary 49 | Success 50 | Danger 51 | Warning 52 | Info 53 | Light 54 | Dark 55 |
56 |
57 |
58 |
59 | Bootstrap Badges 60 | pill badges 61 |
62 |
63 | Primary 64 | Secondary 65 | Success 66 | Danger 67 | Warning 68 | Info 69 | Light 70 | Dark 71 |
72 |
73 |
74 |
75 | Bootstrap Badges 76 | links 77 |
78 |
79 | Primary 80 | Secondary 81 | Success 82 | Danger 83 | Warning 84 | Info 85 | Light 86 | Dark 87 |
88 |
89 |
90 |
91 | 92 |
93 | -------------------------------------------------------------------------------- /Angular/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "sample-auth-guards": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": {}, 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/sample-auth-guards", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "src/tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets", 24 | "src/silent-refresh.html" 25 | ], 26 | "styles": [ 27 | "src/styles.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "aot": true, 45 | "extractLicenses": true, 46 | "vendorChunk": false, 47 | "buildOptimizer": true 48 | } 49 | } 50 | }, 51 | "serve": { 52 | "builder": "@angular-devkit/build-angular:dev-server", 53 | "options": { 54 | "browserTarget": "sample-auth-guards:build" 55 | }, 56 | "configurations": { 57 | "production": { 58 | "browserTarget": "sample-auth-guards:build:production" 59 | } 60 | } 61 | }, 62 | "extract-i18n": { 63 | "builder": "@angular-devkit/build-angular:extract-i18n", 64 | "options": { 65 | "browserTarget": "sample-auth-guards:build" 66 | } 67 | }, 68 | "test": { 69 | "builder": "@angular-devkit/build-angular:karma", 70 | "options": { 71 | "main": "src/test.ts", 72 | "polyfills": "src/polyfills.ts", 73 | "tsConfig": "src/tsconfig.spec.json", 74 | "karmaConfig": "src/karma.conf.js", 75 | "styles": [ 76 | "src/styles.css" 77 | ], 78 | "scripts": [], 79 | "assets": [ 80 | "src/favicon.ico", 81 | "src/assets", 82 | "src/silent-refresh.html" 83 | ] 84 | } 85 | }, 86 | "lint": { 87 | "builder": "@angular-devkit/build-angular:tslint", 88 | "options": { 89 | "tsConfig": [ 90 | "src/tsconfig.app.json", 91 | "src/tsconfig.spec.json" 92 | ], 93 | "exclude": [ 94 | "**/node_modules/**" 95 | ] 96 | } 97 | } 98 | } 99 | }, 100 | "sample-auth-guards-e2e": { 101 | "root": "e2e/", 102 | "projectType": "application", 103 | "architect": { 104 | "e2e": { 105 | "builder": "@angular-devkit/build-angular:protractor", 106 | "options": { 107 | "protractorConfig": "e2e/protractor.conf.js", 108 | "devServerTarget": "sample-auth-guards:serve" 109 | }, 110 | "configurations": { 111 | "production": { 112 | "devServerTarget": "sample-auth-guards:serve:production" 113 | } 114 | } 115 | }, 116 | "lint": { 117 | "builder": "@angular-devkit/build-angular:tslint", 118 | "options": { 119 | "tsConfig": "e2e/tsconfig.e2e.json", 120 | "exclude": [ 121 | "**/node_modules/**" 122 | ] 123 | } 124 | } 125 | } 126 | } 127 | }, 128 | "defaultProject": "sample-auth-guards" 129 | } 130 | -------------------------------------------------------------------------------- /AngularOIDC/src/assets/img/brand/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 25 | 32 | 37 | 38 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/chartjs/chartjs.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | Line Chart 6 | 11 |
12 |
13 |
14 | 23 |
24 |
25 |
26 |
27 |
28 | Bar Chart 29 | 34 |
35 |
36 |
37 | 45 |
46 |
47 |
48 |
49 |
50 | Doughnut Chart 51 | 56 |
57 |
58 |
59 | 65 |
66 |
67 |
68 |
69 |
70 | Radar Chart 71 | 76 |
77 |
78 |
79 | 85 |
86 |
87 |
88 |
89 |
90 | Pie Chart 91 | 96 |
97 |
98 |
99 | 105 |
106 |
107 |
108 |
109 |
110 | Polar Area Chart 111 |
112 | 113 | docs 114 | 115 |
116 |
117 |
118 |
119 | 126 |
127 |
128 |
129 |
130 |
131 | -------------------------------------------------------------------------------- /AngularOIDC/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ng": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "architect": { 11 | "build": { 12 | "builder": "@angular-devkit/build-angular:browser", 13 | "options": { 14 | "outputPath": "dist", 15 | "index": "src/index.html", 16 | "main": "src/main.ts", 17 | "tsConfig": "src/tsconfig.app.json", 18 | "polyfills": "src/polyfills.ts", 19 | "assets": [ 20 | "src/assets" 21 | ], 22 | "styles": [ 23 | "node_modules/@coreui/icons/css/coreui-icons.css", 24 | "node_modules/flag-icon-css/css/flag-icon.css", 25 | "node_modules/font-awesome/css/font-awesome.css", 26 | "node_modules/simple-line-icons/css/simple-line-icons.css", 27 | "src/scss/style.scss" 28 | ], 29 | "stylePreprocessorOptions": { 30 | "includePaths": ["./node_modules"] 31 | }, 32 | "scripts": [ 33 | "node_modules/chart.js/dist/Chart.min.js" 34 | ] 35 | }, 36 | "configurations": { 37 | "production": { 38 | "optimization": true, 39 | "outputHashing": "all", 40 | "sourceMap": false, 41 | "extractCss": true, 42 | "namedChunks": false, 43 | "aot": true, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true, 47 | "fileReplacements": [ 48 | { 49 | "replace": "src/environments/environment.ts", 50 | "with": "src/environments/environment.prod.ts" 51 | } 52 | ] 53 | } 54 | } 55 | }, 56 | "serve": { 57 | "builder": "@angular-devkit/build-angular:dev-server", 58 | "options": { 59 | "browserTarget": "ng:build" 60 | }, 61 | "configurations": { 62 | "production": { 63 | "browserTarget": "ng:build:production" 64 | } 65 | } 66 | }, 67 | "extract-i18n": { 68 | "builder": "@angular-devkit/build-angular:extract-i18n", 69 | "options": { 70 | "browserTarget": "ng:build" 71 | } 72 | }, 73 | "test": { 74 | "builder": "@angular-devkit/build-angular:karma", 75 | "options": { 76 | "main": "src/test.ts", 77 | "karmaConfig": "./karma.conf.js", 78 | "polyfills": "src/polyfills.ts", 79 | "tsConfig": "src/tsconfig.spec.json", 80 | "scripts": [ 81 | "node_modules/chart.js/dist/Chart.min.js" 82 | ], 83 | "styles": [ 84 | "node_modules/flag-icon-css/css/flag-icon.css", 85 | "node_modules/font-awesome/css/font-awesome.css", 86 | "node_modules/simple-line-icons/css/simple-line-icons.css", 87 | "src/scss/style.scss" 88 | ], 89 | "stylePreprocessorOptions": { 90 | "includePaths": ["./node_modules"] 91 | }, 92 | "assets": [ 93 | "src/assets", 94 | "src/favicon.ico" 95 | ] 96 | } 97 | }, 98 | "lint": { 99 | "builder": "@angular-devkit/build-angular:tslint", 100 | "options": { 101 | "tsConfig": [ 102 | "src/tsconfig.app.json", 103 | "src/tsconfig.spec.json" 104 | ], 105 | "exclude": [ 106 | "**/node_modules/**" 107 | ] 108 | } 109 | } 110 | } 111 | }, 112 | "ng-e2e": { 113 | "root": "", 114 | "sourceRoot": "", 115 | "projectType": "application", 116 | "architect": { 117 | "e2e": { 118 | "builder": "@angular-devkit/build-angular:protractor", 119 | "options": { 120 | "protractorConfig": "./protractor.conf.js", 121 | "devServerTarget": "ng:serve" 122 | } 123 | }, 124 | "lint": { 125 | "builder": "@angular-devkit/build-angular:tslint", 126 | "options": { 127 | "tsConfig": [ 128 | "e2e/tsconfig.e2e.json" 129 | ], 130 | "exclude": [ 131 | "**/node_modules/**" 132 | ] 133 | } 134 | } 135 | } 136 | } 137 | }, 138 | "defaultProject": "ng", 139 | "schematics": { 140 | "@schematics/angular:component": { 141 | "prefix": "app", 142 | "styleext": "scss" 143 | }, 144 | "@schematics/angular:directive": { 145 | "prefix": "app" 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /VueJS/README.md: -------------------------------------------------------------------------------- 1 | # vuejsoidcclient 2 | 3 | Project vueJs with oidc-client library 4 | 5 | ## Create the development environment 6 | 7 | Npm: 8 | https://nodejs.org/en/download/ 9 | 10 | Npm Version Control on Windows: 11 | https://github.com/felixrieseberg/npm-windows-upgrade 12 | 13 | Npm Version Control on Linux: 14 | https://github.com/creationix/nvm 15 | 16 | ## Technology Version 17 | 18 | Version of npm used in the project: *6.5.0* 19 | Version of oidc-client: *1.6.1* 20 | 21 | ## Identity Provider 22 | 23 | The configuration for the examples are based on running IdentityServer4 on localhost. A ready-to-go reference implementation for testing purposes can be found at [IdentityServer4AndApi][1]. 24 | 25 | ## Documentation 26 | 27 | Oidc-Client: 28 | https://github.com/IdentityModel/oidc-client-js/wiki 29 | 30 | 31 | ## Build Setup 32 | 33 | ``` bash 34 | # install dependencies 35 | npm install 36 | 37 | # serve with hot reload at localhost:8080 38 | npm run dev 39 | 40 | # build for production with minification 41 | npm run prod 42 | ``` 43 | 44 | ## Connection with identity provider 45 | 46 | Change the parameters of the variable **mgr** of the script [SecurityService.js][2] to the values of your identity provider. 47 | ``` bash 48 | var mgr = new Oidc.UserManager({ 49 | userStore: new Oidc.WebStorageStateStore(), 50 | authority: 'https://localhost:44321', 51 | client_id: 'vuejsclient', 52 | redirect_uri: window.location.origin + '/static/callback.html', 53 | response_type: 'id_token token', 54 | scope: 'openid profile address roles identityserver4api country subscriptionlevel offline_access', 55 | post_logout_redirect_uri: window.location.origin + '/index.html', 56 | silent_redirect_uri: window.location.origin + '/static/silent-renew.html', 57 | accessTokenExpiringNotificationTime: 10, 58 | automaticSilentRenew: true, 59 | filterProtocolClaims: true, 60 | loadUserInfo: true 61 | }) 62 | ``` 63 | 64 | The script [SecurityService.js][2] contains triggers and methods from the [oidc-client][3] library. 65 | 66 | ## API 67 | 68 | The script [ApiService.js][4] is responsible for making requests to an API using the libraries [oidc-client][3] and [axios][5] 69 | 70 | The **baseUrl** constant receives the static part of the API Url. 71 | ``` bash 72 | const baseUrl = 'https://localhost:44390/api/'; 73 | ``` 74 | 75 | The **defineHeaderAxios()** method appends the access teken to the axios head. 76 | ``` bash 77 | async defineHeaderAxios () { 78 | await user.getAcessToken().then( 79 | acessToken => { 80 | axios.defaults.headers.common['Authorization'] = 'Bearer ' + acessToken 81 | }, err => { 82 | console.log(err) 83 | }) 84 | } 85 | ``` 86 | 87 | The **getAll()** method makes a get request. It receives as a parameter a string that will be concatenated with the **baseUrl** constant by forming the API Url. 88 | ``` bash 89 | async getAll(api){ 90 | await this.defineHeaderAxios() 91 | return axios 92 | .get(baseUrl + api) 93 | .then(response => response.data) 94 | .catch(err => { 95 | console.log(err); 96 | }) 97 | } 98 | ``` 99 | 100 | ## Route protection 101 | 102 | The script [index.js][7] is responsible for managing the application routes using the [vue router][6]. Each route has a field called **meta**. **Meta** receives two parameters: **requiresAuth** and **role**. 103 | 104 | - **requiresAuth**[Bollean]: Responsible for protecting the route 105 | - **role**[String]: Users with this role will be allowed to access the route 106 | 107 | ``` bash 108 | { 109 | path: '/payinguser', 110 | name: 'PayingUser', 111 | component: PayingUser, 112 | meta: { 113 | requiresAuth: true, 114 | role: ['PayingUser'] 115 | } 116 | }, 117 | { 118 | path: '/freeuser', 119 | name: 'FreeUser', 120 | component: FreeUser, 121 | meta: { 122 | requiresAuth: true, 123 | role: ['FreeUser'] 124 | } 125 | } 126 | ``` 127 | 128 | At each transition of routes in the application, the **router.beforeEach()** method of the script [index.js][8] is called. This method checks whether the user who is logged in is allowed to access the route. It does this by comparing the role of the user and the role of the route. 129 | ``` bash 130 | router.beforeEach((to, from, next) => { 131 | const requiresAuth = to.matched.some(record => record.meta.requiresAuth); 132 | if (requiresAuth) { 133 | mgr.getRole().then( 134 | sucess => { 135 | if (to.meta.role == sucess){ 136 | next(); 137 | }else { 138 | next('/accessdenied'); 139 | } 140 | }, 141 | err => { 142 | console.log(err); 143 | } 144 | ); 145 | } else { 146 | next(); 147 | } 148 | }); 149 | ``` 150 | 151 | [1]: https://github.com/joaojosefilho/IdentityServer4AndApi 152 | [2]: https://github.com/joaojosefilho/vuejsOidcClient/blob/master/src/services/SecurityService.js 153 | [3]: https://github.com/IdentityModel/oidc-client-js/wiki 154 | [4]: https://github.com/joaojosefilho/vuejsOidcClient/blob/master/src/services/ApiService.js 155 | [5]: https://github.com/axios/axios 156 | [6]: https://router.vuejs.org 157 | [7]: https://github.com/joaojosefilho/vuejsOidcClient/blob/master/src/router/index.js 158 | [8]: https://github.com/joaojosefilho/vuejsOidcClient/blob/master/src/index.js 159 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/_nav.ts: -------------------------------------------------------------------------------- 1 | export const navItems = [ 2 | { 3 | name: 'Dashboard', 4 | url: '/dashboard', 5 | icon: 'icon-speedometer', 6 | badge: { 7 | variant: 'info', 8 | text: 'NEW' 9 | } 10 | }, 11 | { 12 | name: 'Cotacao', 13 | url: '/cotacao', 14 | icon: 'icon-speedometer', 15 | badge: { 16 | variant: 'info', 17 | text: 'criptoservices' 18 | } 19 | }, 20 | { 21 | title: true, 22 | name: 'Theme' 23 | }, 24 | { 25 | name: 'Colors', 26 | url: '/theme/colors', 27 | icon: 'icon-drop' 28 | }, 29 | { 30 | name: 'Typography', 31 | url: '/theme/typography', 32 | icon: 'icon-pencil' 33 | }, 34 | { 35 | title: true, 36 | name: 'Components' 37 | }, 38 | { 39 | name: 'Base', 40 | url: '/base', 41 | icon: 'icon-puzzle', 42 | children: [ 43 | { 44 | name: 'Cards', 45 | url: '/base/cards', 46 | icon: 'icon-puzzle' 47 | }, 48 | { 49 | name: 'Carousels', 50 | url: '/base/carousels', 51 | icon: 'icon-puzzle' 52 | }, 53 | { 54 | name: 'Collapses', 55 | url: '/base/collapses', 56 | icon: 'icon-puzzle' 57 | }, 58 | { 59 | name: 'Forms', 60 | url: '/base/forms', 61 | icon: 'icon-puzzle' 62 | }, 63 | { 64 | name: 'Pagination', 65 | url: '/base/paginations', 66 | icon: 'icon-puzzle' 67 | }, 68 | { 69 | name: 'Popovers', 70 | url: '/base/popovers', 71 | icon: 'icon-puzzle' 72 | }, 73 | { 74 | name: 'Progress', 75 | url: '/base/progress', 76 | icon: 'icon-puzzle' 77 | }, 78 | { 79 | name: 'Switches', 80 | url: '/base/switches', 81 | icon: 'icon-puzzle' 82 | }, 83 | { 84 | name: 'Tables', 85 | url: '/base/tables', 86 | icon: 'icon-puzzle' 87 | }, 88 | { 89 | name: 'Tabs', 90 | url: '/base/tabs', 91 | icon: 'icon-puzzle' 92 | }, 93 | { 94 | name: 'Tooltips', 95 | url: '/base/tooltips', 96 | icon: 'icon-puzzle' 97 | } 98 | ] 99 | }, 100 | { 101 | name: 'Buttons', 102 | url: '/buttons', 103 | icon: 'icon-cursor', 104 | children: [ 105 | { 106 | name: 'Buttons', 107 | url: '/buttons/buttons', 108 | icon: 'icon-cursor' 109 | }, 110 | { 111 | name: 'Dropdowns', 112 | url: '/buttons/dropdowns', 113 | icon: 'icon-cursor' 114 | }, 115 | { 116 | name: 'Brand Buttons', 117 | url: '/buttons/brand-buttons', 118 | icon: 'icon-cursor' 119 | } 120 | ] 121 | }, 122 | { 123 | name: 'Charts', 124 | url: '/charts', 125 | icon: 'icon-pie-chart' 126 | }, 127 | { 128 | name: 'Icons', 129 | url: '/icons', 130 | icon: 'icon-star', 131 | children: [ 132 | { 133 | name: 'CoreUI Icons', 134 | url: '/icons/coreui-icons', 135 | icon: 'icon-star', 136 | badge: { 137 | variant: 'success', 138 | text: 'NEW' 139 | } 140 | }, 141 | { 142 | name: 'Flags', 143 | url: '/icons/flags', 144 | icon: 'icon-star' 145 | }, 146 | { 147 | name: 'Font Awesome', 148 | url: '/icons/font-awesome', 149 | icon: 'icon-star', 150 | badge: { 151 | variant: 'secondary', 152 | text: '4.7' 153 | } 154 | }, 155 | { 156 | name: 'Simple Line Icons', 157 | url: '/icons/simple-line-icons', 158 | icon: 'icon-star' 159 | } 160 | ] 161 | }, 162 | { 163 | name: 'Notifications', 164 | url: '/notifications', 165 | icon: 'icon-bell', 166 | children: [ 167 | { 168 | name: 'Alerts', 169 | url: '/notifications/alerts', 170 | icon: 'icon-bell' 171 | }, 172 | { 173 | name: 'Badges', 174 | url: '/notifications/badges', 175 | icon: 'icon-bell' 176 | }, 177 | { 178 | name: 'Modals', 179 | url: '/notifications/modals', 180 | icon: 'icon-bell' 181 | } 182 | ] 183 | }, 184 | { 185 | name: 'Widgets', 186 | url: '/widgets', 187 | icon: 'icon-calculator', 188 | badge: { 189 | variant: 'info', 190 | text: 'NEW' 191 | } 192 | }, 193 | { 194 | divider: true 195 | }, 196 | { 197 | title: true, 198 | name: 'Extras', 199 | }, 200 | { 201 | name: 'Pages', 202 | url: '/pages', 203 | icon: 'icon-star', 204 | children: [ 205 | { 206 | name: 'Login', 207 | url: '/login', 208 | icon: 'icon-star' 209 | }, 210 | { 211 | name: 'Register', 212 | url: '/register', 213 | icon: 'icon-star' 214 | }, 215 | { 216 | name: 'Error 404', 217 | url: '/404', 218 | icon: 'icon-star' 219 | }, 220 | { 221 | name: 'Error 500', 222 | url: '/500', 223 | icon: 'icon-star' 224 | } 225 | ] 226 | }, 227 | { 228 | name: 'Download CoreUI', 229 | url: 'http://coreui.io/angular/', 230 | icon: 'icon-cloud-download', 231 | class: 'mt-auto', 232 | variant: 'success' 233 | }, 234 | { 235 | name: 'Try CoreUI PRO', 236 | url: 'http://coreui.io/pro/angular/', 237 | icon: 'icon-layers', 238 | variant: 'danger' 239 | } 240 | ]; 241 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/tooltips.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Bootstrap Tooltips 5 | 10 |
11 |
12 | 16 |
17 |
18 |
19 |
20 | Tooltips positioning 21 |
22 |
23 | 28 | 29 | 34 | 35 | 40 | 41 | 46 | 47 | 52 |
53 |
54 |
55 |
56 | Tooltips dismissible 57 |
58 |
59 | 64 |
65 |
66 |
67 |
68 | Tooltips dynamic content 69 |
70 |
71 | 74 | 75 | Just another: {{content}} 76 | 79 |
80 |
81 |
82 |
83 | Tooltips dynamic html 84 |
85 |
86 | Here we go:
87 | 91 |
92 |
93 |
94 |
95 | Tooltips append to body 96 |
97 |
98 |
99 |
100 | 104 | 109 |
110 |
111 |
112 |
113 |
114 |
115 | Tooltips custom triggers 116 |
117 |
118 |
119 |
120 |

Desktop

121 | 126 |
127 | 128 |
129 |

Mobile

130 | 135 |
136 |
137 |
138 |
139 |
140 |
141 | Tooltips manual triggers 142 |
143 |
144 |

145 | 147 | This text has attached tooltip 148 | 149 |

150 | 151 | 154 | 157 |
158 |
159 |
160 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/popovers.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Bootstrap Popover 5 | 10 |
11 |
12 | 16 |
17 |
18 |
19 |
20 | Popover 21 | positioning 22 |
23 |
24 | 30 | 31 | 37 | 38 | 44 | 45 | 51 | 52 | 58 |
59 |
60 |
61 |
62 | Popover 63 | focus trigger 64 |
65 |
66 | 72 |
73 |
74 |
75 |
76 | Popover 77 | dynamic content 78 |
79 |
80 | 84 | 85 | Just another: {{content}} 86 | 90 |
91 |
92 |
93 |
94 | Popover 95 | dynamic HTML 96 |
97 |
98 | Here we go: 99 |
100 |
101 | 105 |
106 |
107 |
108 |
109 | Popover 110 | append to body 111 |
112 |
113 |
114 |
115 | 119 | 124 |
125 |
126 |
127 |
128 |
129 |
130 | Popover 131 | custom triggers 132 |
133 |
134 | 139 |
140 |
141 |
142 |
143 | Popover 144 | manual triggering 145 |
146 |
147 |

148 | 150 | This text has attached popover 151 | 152 |

153 | 156 | 159 |
160 |
161 |
162 | -------------------------------------------------------------------------------- /AngularOIDC/src/app/views/base/carousels.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | Bootstrap Carousel 7 | 12 |
13 |
14 | 15 | 16 | First slide 17 | 18 | 19 | Second slide 20 | 21 | 22 | Third slide 23 | 24 | 25 |
26 |
27 |
28 |
29 |
30 |
31 | Carousel 32 | optional captions 33 |
34 |
35 | 36 | 37 | First slide 38 | 42 | 43 | 44 | Second slide 45 | 49 | 50 | 51 | Third slide 52 | 56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | Carousel 67 | configuring defaults 68 |
69 |
70 | 71 | 72 | First slide 73 | 77 | 78 | 79 | Second slide 80 | 84 | 85 | 86 | Third slide 87 | 91 | 92 | 93 |
94 |
95 |
96 |
97 |
98 |
99 | Carousel 100 | dynamic slides 101 |
102 |
103 | 104 | 105 | image slide 106 | 107 | 111 | 112 | 113 |
114 |
115 | 118 | 121 | 124 |
125 |
126 |
127 | 128 |
129 | 130 | Interval, in milliseconds (Enter a negative number or 0 to stop the interval.): 131 | 132 |
133 |
134 |
135 |
136 |
137 |
138 | --------------------------------------------------------------------------------