Skip to content

Commit ef54898

Browse files
committed
erge conflicts resolved
2 parents 2def702 + f0791bd commit ef54898

21 files changed

+8531
-488
lines changed

README.MD

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ https://manfredsteyer.github.io/angular-oauth2-oidc/angular-oauth2-oidc/docs/
2727

2828
## Tested Environment
2929

30-
Successfully tested with Angular 4.3+, Angular 5 and its Router,PathLocationStrategy as well as HashLocationStrategy and CommonJS-Bundling via webpack. At server side we've used IdentityServer (.NET/ .NET Core) and Redhat's Keycloak (Java).
30+
Successfully tested with Angular 4.3+, Angular 5 and its Router, PathLocationStrategy as well as HashLocationStrategy and CommonJS-Bundling via webpack. At server side we've used IdentityServer (.NET/ .NET Core) and Redhat's Keycloak (Java).
3131

3232
## Release Cycle
3333

@@ -272,8 +272,7 @@ OAuthModule.forRoot({
272272

273273
## Routing
274274

275-
If you use the ``PathLocationStragegy`` (which is on by default) and have a general catch-all-route (``path: '**'``) you should be fine. Otherwise look up the section ``Routing with the HashStrategy`` in the [documation](https://manfredsteyer.github.io/angular-oauth2-oidc/angular-oauth2-oidc/docs/).
276-
275+
If you use the ``PathLocationStrategy`` (which is on by default) and have a general catch-all-route (``path: '**'``) you should be fine. Otherwise look up the section ``Routing with the HashStrategy`` in the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/angular-oauth2-oidc/docs/).
277276

278277
## More Documentation
279278

angular-oauth2-oidc/README.MD

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/release
5959
- Providing Events via the observable ``events``.
6060
- The event ``token_expires`` can be used together with a silent refresh to automatically refresh a token when/ before it expires (see also property ``timeoutFactor``).
6161

62-
## Additional Features
62+
## Additional Features
6363
- Logging in via OAuth2 and OpenId Connect (OIDC) Implicit Flow (where user is redirected to Identity Provider)
6464
- "Logging in" via Password Flow (where user enters his/her password into the client)
6565
- Token Refresh for Password Flow by using a Refresh Token
@@ -83,7 +83,7 @@ You can use the OIDC-Sample-Server mentioned in the samples for Testing. It assu
8383

8484
Username/Password: max/geheim
8585

86-
*clientIds:*
86+
*clientIds:*
8787
- spa-demo (implicit flow)
8888
- demo-resource-owner (resource owner password flow)
8989

@@ -105,7 +105,7 @@ import { OAuthModule } from 'angular-oauth2-oidc';
105105
[...]
106106

107107
@NgModule({
108-
imports: [
108+
imports: [
109109
[...]
110110
HttpModule,
111111
OAuthModule.forRoot()
@@ -116,13 +116,13 @@ import { OAuthModule } from 'angular-oauth2-oidc';
116116
[...]
117117
],
118118
bootstrap: [
119-
AppComponent
119+
AppComponent
120120
]
121121
})
122122
export class AppModule {
123123
}
124124

125-
```
125+
```
126126

127127
## Configuring for Implicit Flow
128128

@@ -236,9 +236,9 @@ The following snippet contains the template for the login page:
236236

237237
### Skipping the Login Form
238238

239-
If you don't want to display a login form that tells the user that they are redirected to the identity server, you can use the convenince function ``this.oauthService.loadDiscoveryDocumentAndLogin();`` instead of ``this.oauthService.loadDiscoveryDocumentAndTryLogin();`` when setting up the library.
239+
If you don't want to display a login form that tells the user that they are redirected to the identity server, you can use the convenince function ``this.oauthService.loadDiscoveryDocumentAndLogin();`` instead of ``this.oauthService.loadDiscoveryDocumentAndTryLogin();`` when setting up the library.
240240

241-
This directly redirects the user to the identity server if there are no valid tokens.
241+
This directly redirects the user to the identity server if there are no valid tokens.
242242

243243

244244
### Calling a Web API with an Access Token

angular-oauth2-oidc/docs/additional-documentation/working-with-httpinterceptors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@
593593

594594

595595
<h1 id="interceptors">Interceptors</h1>
596-
<p>Since 3.1 the library uses a default HttpInterceptor that takes care about transmitting the access_token to the resource server and about error handling for security related errors (HTTP status codes 401 and 403) received from the resource server. To put in on, just set <code>sendAccessToken</code> to <code>true</code> and set <code>allowedUrls</code> to an array with prefixes for the respective urls. Use lower case for the prefixes:</p>
596+
<p>Since 3.1 the library uses a default HttpInterceptor that takes care about transmitting the access_token to the resource server and about error handling for security related errors (HTTP status codes 401 and 403) received from the resource server. To enable it, just set <code>sendAccessToken</code> to <code>true</code> and set <code>allowedUrls</code> to an array with prefixes for the respective urls. Use lower case for the prefixes:</p>
597597
<pre class="line-numbers"><code class="language-TypeScript">OAuthModule.forRoot({
598598
resourceServer: {
599599
allowedUrls: [&#39;http://www.angular.at/api&#39;],

angular-oauth2-oidc/gulpfile.js

Lines changed: 74 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
/* eslint-disable */
22
var gulp = require('gulp'),
3-
path = require('path'),
4-
ngc = require('@angular/compiler-cli/src/main').main,
5-
rollup = require('gulp-rollup'),
6-
rename = require('gulp-rename'),
7-
del = require('del'),
8-
runSequence = require('run-sequence'),
9-
inlineResources = require('./tools/gulp/inline-resources');
3+
path = require('path'),
4+
ngc = require('@angular/compiler-cli/src/main').main,
5+
rollup = require('gulp-rollup'),
6+
rename = require('gulp-rename'),
7+
del = require('del'),
8+
runSequence = require('run-sequence'),
9+
inlineResources = require('./tools/gulp/inline-resources');
1010

1111
const rootFolder = path.join(__dirname);
1212
const srcFolder = path.join(rootFolder, 'src');
1313
const tmpFolder = path.join(rootFolder, '.tmp');
1414
const buildFolder = path.join(rootFolder, 'build');
1515
const distFolder = path.join(rootFolder, 'dist');
16+
const bundlesFolder = path.join(distFolder, 'bundles');
1617

1718
/**
1819
* 1. Delete /dist folder
1920
*/
2021
gulp.task('clean:dist', function () {
2122

22-
// Delete contents but not dist folder to avoid broken npm links
23-
// when dist directory is removed while npm link references it.
24-
return deleteFolders([distFolder + '/**', '!' + distFolder]);
23+
// Delete contents but not dist folder to avoid broken npm links
24+
// when dist directory is removed while npm link references it.
25+
return deleteFolders([distFolder + '/**', '!' + distFolder]);
2526
});
2627

2728
/**
@@ -30,17 +31,17 @@ return deleteFolders([distFolder + '/**', '!' + distFolder]);
3031
* when copying to /.tmp.
3132
*/
3233
gulp.task('copy:source', function () {
33-
return gulp.src([`${srcFolder}/**/*`, `!${srcFolder}/node_modules`])
34-
.pipe(gulp.dest(tmpFolder));
34+
return gulp.src([`${srcFolder}/**/*`, `!${srcFolder}/node_modules`])
35+
.pipe(gulp.dest(tmpFolder));
3536
});
3637

3738
/**
3839
* 3. Inline template (.html) and style (.css) files into the the component .ts files.
3940
* We do this on the /.tmp folder to avoid editing the original /src files
4041
*/
4142
gulp.task('inline-resources', function () {
42-
return Promise.resolve()
43-
.then(() => inlineResources(tmpFolder));
43+
return Promise.resolve()
44+
.then(() => inlineResources(tmpFolder));
4445
});
4546

4647

@@ -49,168 +50,112 @@ return Promise.resolve()
4950
* compiled modules to the /build folder.
5051
*/
5152
gulp.task('ngc', function () {
52-
return ngc({
53-
project: `${tmpFolder}/tsconfig.es5.json`
54-
})
55-
.then((exitCode) => {
56-
if (exitCode === 1) {
57-
// This error is caught in the 'compile' task by the runSequence method callback
58-
// so that when ngc fails to compile, the whole compile process stops running
59-
throw new Error('ngc compilation failed');
60-
}
61-
});
53+
return ngc([], function (s) {
54+
throw new Error(s);
55+
})
6256
});
6357

6458
/**
6559
* 5. Run rollup inside the /build folder to generate our Flat ES module and place the
6660
* generated file into the /dist folder
6761
*/
68-
gulp.task('rollup:fesm', function () {
69-
return gulp.src(`${buildFolder}/**/*.js`)
70-
// transform the files here.
71-
.pipe(rollup({
72-
73-
// Bundle's entry point
74-
// See "input" in https://rollupjs.org/#core-functionality
75-
input: `${buildFolder}/index.js`,
76-
77-
// Allow mixing of hypothetical and actual files. "Actual" files can be files
78-
// accessed by Rollup or produced by plugins further down the chain.
79-
// This prevents errors like: 'path/file' does not exist in the hypothetical file system
80-
// when subdirectories are used in the `src` directory.
81-
allowRealFiles: true,
82-
83-
// A list of IDs of modules that should remain external to the bundle
84-
// See "external" in https://rollupjs.org/#core-functionality
85-
external: [
86-
'@angular/core',
87-
'@angular/common'
88-
],
89-
90-
// Format of generated bundle
91-
// See "format" in https://rollupjs.org/#core-functionality
92-
format: 'es'
93-
}))
94-
.pipe(gulp.dest(distFolder));
95-
});
96-
97-
/**
98-
* 6. Run rollup inside the /build folder to generate our UMD module and place the
99-
* generated file into the /dist folder
100-
*/
10162
gulp.task('rollup:umd', function () {
102-
return gulp.src(`${buildFolder}/**/*.js`)
103-
// transform the files here.
104-
.pipe(rollup({
105-
106-
// Bundle's entry point
107-
// See "input" in https://rollupjs.org/#core-functionality
108-
input: `${buildFolder}/index.js`,
109-
110-
// Allow mixing of hypothetical and actual files. "Actual" files can be files
111-
// accessed by Rollup or produced by plugins further down the chain.
112-
// This prevents errors like: 'path/file' does not exist in the hypothetical file system
113-
// when subdirectories are used in the `src` directory.
114-
allowRealFiles: true,
115-
116-
// A list of IDs of modules that should remain external to the bundle
117-
// See "external" in https://rollupjs.org/#core-functionality
118-
external: [
119-
'@angular/core',
120-
'@angular/common'
121-
],
122-
123-
// Format of generated bundle
124-
// See "format" in https://rollupjs.org/#core-functionality
125-
format: 'umd',
126-
127-
// Export mode to use
128-
// See "exports" in https://rollupjs.org/#danger-zone
129-
exports: 'named',
130-
131-
// The name to use for the module for UMD/IIFE bundles
132-
// (required for bundles with exports)
133-
// See "name" in https://rollupjs.org/#core-functionality
134-
name: 'angular-oauth2-oidc',
135-
136-
// See "globals" in https://rollupjs.org/#core-functionality
137-
globals: {
138-
typescript: 'ts'
139-
}
140-
141-
}))
142-
.pipe(rename('angular-oauth2-oidc.umd.js'))
143-
.pipe(gulp.dest(distFolder));
63+
return gulp.src(`${buildFolder}/**/*.js`)
64+
// transform the files here.
65+
.pipe(rollup({
66+
67+
// Bundle's entry point
68+
// See "input" in https://rollupjs.org/#core-functionality
69+
entry: `${buildFolder}/index.js`,
70+
// A list of IDs of modules that should remain external to the bundle
71+
// See "external" in https://rollupjs.org/#core-functionality
72+
external: [
73+
'@angular/core',
74+
'@angular/common'
75+
],
76+
// Format of generated bundle
77+
// See "format" in https://rollupjs.org/#core-functionality
78+
output: {
79+
name: 'UMD',
80+
format: 'umd',
81+
globals: {
82+
typescript: 'ts'
83+
}
84+
},
85+
}))
86+
.pipe(rename('angular-oauth2-oidc.umd.js'))
87+
.pipe(gulp.dest(bundlesFolder))
88+
;
14489
});
14590

91+
14692
/**
14793
* 7. Copy all the files from /build to /dist, except .js files. We ignore all .js from /build
14894
* because with don't need individual modules anymore, just the Flat ES module generated
14995
* on step 5.
15096
*/
15197
gulp.task('copy:build', function () {
152-
return gulp.src([`${buildFolder}/**/*`, `!${buildFolder}/**/*.js`])
153-
.pipe(gulp.dest(distFolder));
98+
return gulp.src([`${buildFolder}/**/*`])
99+
.pipe(gulp.dest(distFolder));
154100
});
155101

156102
/**
157103
* 8. Copy package.json from /src to /dist
158104
*/
159105
gulp.task('copy:manifest', function () {
160-
return gulp.src([`${srcFolder}/package.json`])
161-
.pipe(gulp.dest(distFolder));
106+
return gulp.src([`${srcFolder}/package.json`])
107+
.pipe(gulp.dest(distFolder));
162108
});
163109

164110
/**
165111
* 9. Copy README.md from / to /dist
166112
*/
167113
gulp.task('copy:readme', function () {
168-
return gulp.src([path.join(rootFolder, 'README.MD')])
169-
.pipe(gulp.dest(distFolder));
114+
return gulp.src([path.join(rootFolder, 'README.MD')])
115+
.pipe(gulp.dest(distFolder));
170116
});
171117

172118
/**
173119
* 10. Delete /.tmp folder
174120
*/
175121
gulp.task('clean:tmp', function () {
176-
return deleteFolders([tmpFolder]);
122+
return deleteFolders([tmpFolder]);
177123
});
178124

179125
/**
180126
* 11. Delete /build folder
181127
*/
182128
gulp.task('clean:build', function () {
183-
return deleteFolders([buildFolder]);
129+
return deleteFolders([buildFolder]);
184130
});
185131

186132
gulp.task('compile', function () {
187-
runSequence(
188-
'clean:dist',
189-
'copy:source',
190-
'inline-resources',
191-
'ngc',
192-
'rollup:fesm',
193-
'rollup:umd',
194-
'copy:build',
195-
'copy:manifest',
196-
'copy:readme',
197-
'clean:build',
198-
'clean:tmp',
199-
function (err) {
200-
if (err) {
201-
console.log('ERROR:', err.message);
202-
deleteFolders([distFolder, tmpFolder, buildFolder]);
203-
} else {
204-
console.log('Compilation finished succesfully');
205-
}
206-
});
133+
runSequence(
134+
'clean:dist',
135+
'copy:source',
136+
'inline-resources',
137+
'ngc',
138+
'rollup:umd',
139+
'copy:build',
140+
'copy:manifest',
141+
'copy:readme',
142+
'clean:build',
143+
'clean:tmp',
144+
function (err) {
145+
if (err) {
146+
console.log('ERROR:', err.message);
147+
deleteFolders([distFolder, tmpFolder, buildFolder]);
148+
} else {
149+
console.log('Compilation finished succesfully');
150+
}
151+
});
207152
});
208153

209154
/**
210155
* Watch for any change in the /src folder and compile files
211156
*/
212157
gulp.task('watch', function () {
213-
gulp.watch(`${srcFolder}/**/*`, ['compile']);
158+
gulp.watch(`${srcFolder}/**/*`, ['compile']);
214159
});
215160

216161
gulp.task('clean', ['clean:dist', 'clean:tmp', 'clean:build']);
@@ -223,5 +168,5 @@ gulp.task('default', ['build:watch']);
223168
* Deletes the specified folder
224169
*/
225170
function deleteFolders(folders) {
226-
return del(folders);
171+
return del(folders);
227172
}

angular-oauth2-oidc/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export * from './src/angular-oauth-oidic.module';
2+
export * from './src/oauth-service';
3+
export * from './src/token-validation/jwks-validation-handler';
4+
export * from './src/token-validation/null-validation-handler';
5+
export * from './src/token-validation/validation-handler';
6+
export * from './src/url-helper.service';
7+
export * from './src/auth.config';
8+
export * from './src/types';
9+
export * from './src/tokens';
10+
export * from './src/events';
11+
export * from './src/interceptors/default-oauth.interceptor';
12+
export * from './src/interceptors/resource-server-error-handler';
13+
export * from './src/oauth-module.config';

0 commit comments

Comments
 (0)