Skip to content

Added customUrlValidation #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
700a468
Updated all trylogin functions to return Promise<Boolean>
ajpierson May 30, 2018
04f8a39
reverted to previous .gitignore
ajpierson May 30, 2018
4d2e48a
added cpr as a dev dependency since it's used in the build
ajpierson May 31, 2018
15bff0c
Issue #343 onTokenReceived callback is not called if no iodc after tr…
Jun 4, 2018
38feedf
Improved url check in intercveptor by adding customUrlValidation
Jun 6, 2018
6d471ee
Opened storeAccessTokenResponse to public to for users that uses othe…
Jun 6, 2018
77cb37a
feat: remove jsrsasign dependancy
Jun 15, 2018
290c801
fixup! feat: remove jsrsasign dependancy
Jun 16, 2018
43ecad5
fixup! feat: remove jsrsasign dependancy
Jun 16, 2018
c2cce4e
fixup! feat: remove jsrsasign dependancy
Jun 16, 2018
c1e63de
Remove obsolete/commented code
jeroenheijmans Jun 16, 2018
946c5ef
Rename property to non-obsolete version in docs
jeroenheijmans Jun 16, 2018
08210ca
Fix various minor issues
jeroenheijmans Jun 16, 2018
bc6c4e1
Add documentation for loadDisco....And...() functions
jeroenheijmans Jun 16, 2018
3da25e1
Change 'Authentication' to 'Authorization'
jeroenheijmans Jul 1, 2018
bf5ef56
Clarify imports in README example
jeroenheijmans Jul 1, 2018
fe5cc59
Change "BASIC" to "Basic"
jeroenheijmans Jul 26, 2018
24c3c90
Use responseType parameter
mpbalmeida Aug 4, 2018
78d8502
Docs: fix english
lukasmatta Aug 5, 2018
2c80f80
upgrade example to new rxjs (6?) syntax with operators in .pipe()
hellerbarde Aug 6, 2018
45d8d75
updated links in readme
manfredsteyer Sep 13, 2018
888ea47
Decouple OAuthService from console
jeroenheijmans Sep 15, 2018
4e33567
Merge pull request #427 from jeroenheijmans/refactor/decouple-from-co…
manfredsteyer Sep 19, 2018
b2db7bf
Merge pull request #399 from hellerbarde/patch-1
manfredsteyer Sep 19, 2018
b99c2c3
Merge pull request #398 from lukasmatta/docs-fix-english
manfredsteyer Sep 19, 2018
25ca5c6
Merge pull request #397 from mpbalmeida/master
manfredsteyer Sep 19, 2018
c446b7b
Merge pull request #372 from jeroenheijmans/docs/readme-imports-clari…
manfredsteyer Sep 19, 2018
0cac039
Merge pull request #371 from jeroenheijmans/fix/basic-auth-header
manfredsteyer Sep 19, 2018
8fb836d
Merge branch 'master' into docs/fix-minor-comment-issues
manfredsteyer Sep 19, 2018
b99db0f
Merge pull request #357 from jeroenheijmans/docs/fix-minor-comment-is…
manfredsteyer Sep 19, 2018
bf279c6
Merge pull request #345 from denisbeklarov/onTokenReceived-callback-f…
manfredsteyer Sep 19, 2018
1266843
Merge branch 'master' into master
manfredsteyer Sep 19, 2018
7c752e5
Merge pull request #339 from NwBankTech/master
manfredsteyer Sep 19, 2018
846415f
Merge branch 'master' into master
manfredsteyer Sep 19, 2018
f49190e
Merge pull request #356 from Toxicable/master
manfredsteyer Sep 19, 2018
874873a
Session check changed to run outside of Angular zone so that view ref…
martin1cerny Sep 27, 2018
a8df704
Merge pull request #441 from martin1cerny/master
manfredsteyer Oct 5, 2018
aecf660
Update oauth-service.ts
jdgeier Oct 5, 2018
1610395
Merge pull request #1 from jdgeier/issue/439
jdgeier Oct 5, 2018
3e4b705
Merge pull request #448 from jdgeier/master
manfredsteyer Oct 18, 2018
1f9664f
Update to Angular 7
akehir Oct 19, 2018
2ac4501
Merge pull request #456 from akehir/feature/angular-7
manfredsteyer Oct 23, 2018
1eec310
v5 for Angular 7
manfredsteyer Oct 23, 2018
2eb3fa0
Add LICENSE back to repository
jeroenhinfi Oct 24, 2018
3a01fe9
Merge pull request #459 from jeroenheijmans/fix/add-license-back
manfredsteyer Oct 24, 2018
c2162d0
downgrade to jsrsasign
manfredsteyer Oct 24, 2018
2863669
Merge branch 'master' of https://github.com/manfredsteyer/angular-oau…
manfredsteyer Oct 24, 2018
940f315
Added option to set up silent refresh only for certain type of token.
martin1cerny Oct 25, 2018
0274cf5
Merge pull request #462 from martin1cerny/master
manfredsteyer Oct 25, 2018
2e37425
Improved url check in intercveptor by adding customUrlValidation
Jun 6, 2018
b24b4be
Opened storeAccessTokenResponse to public to for users that uses othe…
Jun 6, 2018
44532af
Merge branch 'master' of https://github.com/vytautas-pranskunas-/angu…
Apr 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# Change Log

## New Features in Version 4.0.0
## Lates features

See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases/tag/4.0.0)

## New Features in Version 3.1

See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases/tag/3.1)

## New Features in Version 3.0

See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases/tag/3.0.1)
See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases)

## New Features in Version 2.1
- New Config API (the original one is still supported)
Expand Down
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2017 Manfred Steyer

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Support for OAuth 2 and OpenId Connect (OIDC) in Angular.
## Credits

- [generator-angular2-library](https://github.com/jvandemo/generator-angular2-library) for scaffolding an Angular library
- [jsrasign](https://kjur.github.io/jsrsasign/) for validating token signature and for hashing
- [jsrasign](https://kjur.github.io/jsrsasign/) until version 5: For validating token signature and for hashing; beginning with version 6, we are using browser APIs to minimize our bundle size
- [Identity Server](https://github.com/identityserver) (used for testing with an .NET/.NET Core Backend)
- [Keycloak (Redhat)](http://www.keycloak.org/) for testing with Java

Expand All @@ -21,24 +21,26 @@ https://manfredsteyer.github.io/angular-oauth2-oidc/docs

## Tested Environment

Successfully tested with **Angular 6** 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).
Successfully tested with **Angular 7** 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).

**Angular 6**: Use Version 4.x of this library. Version 4.x was tested with Angular 6. You can also try the newer version 5.x of this library which has a much smaller bundle size.

**Angular 5.x or 4.3**: If you need support for Angular < 6 (4.3 to 5.x) you can download the former version 3.1.4 (npm i angular-oauth2-oidc@^3 --save).

## Release Cycle

- One major release for each Angular version
- We plan one major release for each Angular version
- Will contain new features
- Will contain bug fixes and PRs
- Critical Bugfixes on a regular basis
- Critical Bugfixes on demand

## Contributions
- Feel free to file pull requests
- The closed issues contain some ideas for PRs and enhancements (see labels)

# Features
- Logging in via OAuth2 and OpenId Connect (OIDC) Implicit Flow (where user is redirected to Identity Provider)
- "Logging in" via Password Flow (where user enters their password into the client)
- Logging in via OAuth2 and OpenId Connect (OIDC) Implicit Flow (where a user is redirected to Identity Provider)
- "Logging in" via Password Flow (where a user enters their password into the client)
- Token Refresh for Password Flow by using a Refresh Token
- Automatically refreshing a token when/some time before it expires
- Querying Userinfo Endpoint
Expand Down Expand Up @@ -71,27 +73,27 @@ npm i angular-oauth2-oidc --save
## Importing the NgModule

```TypeScript
import { HttpClientModule } from '@angular/common/http';
import { OAuthModule } from 'angular-oauth2-oidc';
[...]
// etc.

@NgModule({
imports: [
[...]
HttpModule,
// etc.
HttpClientModule,
OAuthModule.forRoot()
],
declarations: [
AppComponent,
HomeComponent,
[...]
// etc.
],
bootstrap: [
AppComponent
]
})
export class AppModule {
}

```

## Configuring for Implicit Flow
Expand All @@ -100,7 +102,7 @@ This section shows how to implement login leveraging implicit flow. This is the
Single Page Application. It sends the user to the Identity Provider's login page. After logging in, the SPA gets tokens.
This also allows for single sign on as well as single sign off.

To configure the library the following sample uses the new configuration API introduced with Version 2.1.
To configure the library, the following sample uses the new configuration API introduced with Version 2.1.
Hence, the original API is still supported.

```TypeScript
Expand Down Expand Up @@ -229,7 +231,7 @@ var headers = new HttpHeaders({
});
```

Since 3.1 you can also automate this task by switching ``sendAccessToken`` on and by setting ``allowedUrls`` to an array with prefixes for the respective urls. Use lower case for the prefixes.
Since 3.1 you can also automate this task by switching ``sendAccessToken`` on and by setting ``allowedUrls`` to an array with prefixes for the respective URLs. Use lower case for the prefixes.

```TypeScript
OAuthModule.forRoot({
Expand All @@ -250,10 +252,11 @@ See the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/docs

## Tutorials

* [Tutorial with Demo Servers available online](https://www.softwarearchitekt.at/post/2016/07/03/authentication-in-angular-2-with-oauth2-oidc-and-guards-for-the-newest-new-router-english-version.aspx)
* [Angular Authentication with OpenID Connect and Okta in 20 Minutes](https://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc)
* [Add Authentication to Your Angular PWA](https://developer.okta.com/blog/2017/06/13/add-authentication-angular-pwa)
* [Build an Ionic App with User Authentication](https://developer.okta.com/blog/2017/08/22/build-an-ionic-app-with-user-authentication)

* [On-Site Workshops](https://www.softwarearchitekt.at)



Expand Down
6 changes: 3 additions & 3 deletions docs-src/session-checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const authConfig: AuthConfig = {
To get notified, you can hook up for the event ``session_terminated``:

```TypeScript
this.oauthService.events.filter(e => e.type === 'session_terminated').subscribe(e => {
console.debug('Your session has been terminated!');
this.oauthService.events.pipe(filter(e => e.type === 'session_terminated')).subscribe(e => {
console.debug('Your session has been terminated!');
})
```
```
2 changes: 1 addition & 1 deletion docs-src/silent-refresh.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ this
.catch(err => console.error('refresh error', err));
```

When there is an error in the iframe that prevents the communication with the main application, silentRefresh will give you a timeout. To configure the timespan for this, you can set the property ``siletRefreshTimeout`` (msec). The default value is 20.000 (20 seconds).
When there is an error in the iframe that prevents the communication with the main application, silentRefresh will give you a timeout. To configure the timespan for this, you can set the property ``silentRefreshTimeout`` (msec). The default value is 20.000 (20 seconds).

### Automatically refreshing a token when/ before it expires

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ <h1 id="refreshing-a-token-when-using-implicit-flow-silent-refresh-">Refreshing
.oauthService
.silentRefresh()
.then(info =&gt; console.debug(&#39;refresh ok&#39;, info))
.catch(err =&gt; console.error(&#39;refresh error&#39;, err));</code></pre><p>When there is an error in the iframe that prevents the communication with the main application, silentRefresh will give you a timeout. To configure the timespan for this, you can set the property <code>siletRefreshTimeout</code> (msec). The default value is 20.000 (20 seconds).</p>
.catch(err =&gt; console.error(&#39;refresh error&#39;, err));</code></pre><p>When there is an error in the iframe that prevents the communication with the main application, silentRefresh will give you a timeout. To configure the timespan for this, you can set the property <code>silentRefreshTimeout</code> (msec). The default value is 20.000 (20 seconds).</p>
<h3 id="automatically-refreshing-a-token-when-before-it-expires">Automatically refreshing a token when/ before it expires</h3>
<p>To automatically refresh a token when/ some time before it expires, just call the following method after configuring the OAuthService:</p>
<pre class="line-numbers"><code class="language-TypeScript">this.oauthService.setupAutomaticSilentRefresh();</code></pre><p>By default, this event is fired after 75% of the token&#39;s life time is over. You can adjust this factor by setting the property <code>timeoutFactor</code> to a value between 0 and 1. For instance, 0.5 means, that the event is fired after half of the life time is over and 0.33 triggers the event after a third.</p>
Expand Down
Loading