Skip to content

Commit

Permalink
update to offical and new cli
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurphzyo committed Nov 19, 2016
1 parent 53b7ba2 commit 3c2c52e
Show file tree
Hide file tree
Showing 49 changed files with 479 additions and 382 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ root = true
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

# IDEs and editors
/.idea
/.vscode
.project
.classpath
.c9/
*.launch
.settings/

Expand All @@ -32,5 +34,3 @@ testem.log
.DS_Store
Thumbs.db

#vs code folder
/.vscode
Binary file modified .vscode/.BROWSE.VC.DB
Binary file not shown.
Binary file removed .vscode/.BROWSE.VC.DB-wal
Binary file not shown.
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
41 changes: 2 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,6 @@
# Angular2OidcClient

This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.11-webpack.2.

## Setup
Clone the repo
```bash
git clone https://github.com/jmurphzyo/Angular2OidcClient.git
```
Go to the projects root dir.
```bash
cd Angular2OidcClient
```
Install required packages.
```bash
npm i
```
I added an extra folder to the project `oidc-client-@types` copy the contents of that folder, then navigate to node_modules/@types. Create a folder inside the @types folder named oidc-client and paste the copied contents inside.
(side note if you're using vs code and have not updated to typescript 2.0, you need to change your workspace preferences to the following.... this will remove the errors generated by the IDE.)
```
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
```

Once these steps are complete make sure the settings inside `src/app/shared/services/auth.service.ts#L165` are set to your IdentityServer settings.

Run `ng b` followed by `ng s`. Navigate to `http://localhost:4200/`.

I added a brief section at the bottom of the auth service to show how to make authenicatied request using the Angular 2 request pipe line.

You can also add the identity server settings inside the enviorment area so if you run a production build the urls would change over autoimatically.

## Additonal Info
I also added a protected route to show how you can use this client to protect routes and redirect to unauthorized pages.


## Side Notes
This project was created for demonstration purposes to show how to use the oidc-client that was created by the IdentityModel team. If you have any questions feel free to add it to the issues section. Also if there is something you would like to add to the repo submit a pull request and if it doesn't break anything I will accept it.

This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.20-4.

## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
Expand All @@ -56,7 +19,7 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.

## Deploying to Github Pages
Expand Down
47 changes: 37 additions & 10 deletions angular-cli.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,59 @@
{
"project": {
"version": "1.0.0-beta.11-webpack.2",
"version": "1.0.0-beta.20-4",
"name": "angular2-oidc-client"
},
"apps": [
{
"main": "src/main.ts",
"tsconfig": "src/tsconfig.json",
"mobile": false
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.scss"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "config/protractor.conf.js"
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "config/karma.conf.js"
"config": "./karma.conf.js"
}
},
"defaults": {
"prefix": "app",
"sourceDir": "src",
"styleExt": "scss",
"styleExt": "css",
"prefixInterfaces": false,
"lazyRoutePrefix": "+"
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}
2 changes: 2 additions & 0 deletions e2e/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { browser, element, by } from 'protractor';

export class Angular2OidcClientPage {
navigateTo() {
return browser.get('/');
Expand Down
43 changes: 43 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-remap-istanbul'),
require('angular-cli/plugins/karma')
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['angular-cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'karma-remap-istanbul']
: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
175 changes: 0 additions & 175 deletions oidc-client-@types/index.d.ts

This file was deleted.

Loading

0 comments on commit 3c2c52e

Please sign in to comment.