Skip to content

Commit

Permalink
refactor: use esm for sha-256
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Jun 30, 2020
1 parent b486546 commit 92ee76d
Show file tree
Hide file tree
Showing 11 changed files with 655 additions and 279 deletions.
4 changes: 2 additions & 2 deletions docs/additional-documentation/refreshing-a-token.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<h1 id="refreshing-a-token-using-code-flow-not-implicit-flow">Refreshing a Token using Code Flow (not Implicit Flow!)</h1>
<p>When using code flow, you can get an <code>refresh_token</code>. While the original standard DOES NOT allow this for SPAs, the mentioned <a href="https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13">OAuth 2.0 Security Best Current Practice</a> document proposes to ease this limitation. However, it specifies a list of requirements one should take care about before using <code>refresh_tokens</code>. Please make sure you respect those requirements.</p>
<p>Please also note, that you have to request the <code>offline_access</code> scope to get an refresh token.</p>
<p>To refresh your token, just call the <code>refresh</code> method:</p>
<div><pre class="line-numbers"><code class="language-typescript">this.oauthService.refresh();</code></pre></div><h2 id="automatically-refreshing-a-token-when-before-it-expires-code-flow-and-implicit-flow">Automatically refreshing a token when/ before it expires (Code Flow and Implicit Flow)</h2>
<p>To refresh your token, just call the <code>refreshToken</code> method:</p>
<div><pre class="line-numbers"><code class="language-typescript">this.oauthService.refreshToken();</code></pre></div><h2 id="automatically-refreshing-a-token-when-before-it-expires-code-flow-and-implicit-flow">Automatically refreshing a token when/ before it expires (Code Flow and Implicit Flow)</h2>
<p>To automatically refresh a token when/ some time before it expires, just call the following method after configuring the <code>OAuthService</code>:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">this.oauthService.setupAutomaticSilentRefresh();</code></pre></div><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
7 changes: 0 additions & 7 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,10 @@ <h3 id="921-2020-04-23"><a href="https://github.com/manfredsteyer/angular-oauth2
<h2 id="920-2020-03-28"><a href="https://github.com/manfredsteyer/angular-oauth2-oidc/compare/v9.1.0...v9.2.0">9.2.0</a> (2020-03-28)</h2>
<h3 id="features">Features</h3>
<ul>
<<<<<<< HEAD
<li><p><strong>revoketokenandlogout:</strong> explicit way to revoke an access token according to <a href="https://tools.ietf.org/html/rfc7009">RFC 7009</a> (<a href="https://github.com/manfredsteyer/angular-oauth2-oidc/commit/c799eadbfa616d459af8be1a667499834745d78f">c799ead</a>)</p>
</li>
<li><p><strong>token-revocation:</strong> also revoke refresh_token (<a href="https://github.com/manfredsteyer/angular-oauth2-oidc/commit/429ed2c5b50c60ac857ff0ffe84c1d7fc995c6dd">429ed2c</a>)</p>
</li>
=======
<li><strong>automatic silent refresh:</strong> stopAutomaticRefresh stops all timers. (<a href="https://github.com/manfredsteyer/angular-oauth2-oidc/commit/8ab853bf38dd162060d7b6cbd18f7b4fd5a84f18">8ab853b</a>)</li>
<li><strong>code-flow:</strong> allow using silent refresh by setting useSilentRefresh to true (<a href="https://github.com/manfredsteyer/angular-oauth2-oidc/commit/93902a5808bb9b75a41d4bde44c6ab763bcfa9f6">93902a5</a>)</li>
<li><strong>sample:</strong> Also use new Identity Server 4 for implicit flow demo to prevent issues with same site cookies (<a href="https://github.com/manfredsteyer/angular-oauth2-oidc/commit/58c63541bc7d83d72c30577da2b68ac2d1dc35b7">58c6354</a>)</li>
<li><strong>session checks:</strong> Session checks work now for code flow too. Please see docs for details. (<a href="https://github.com/manfredsteyer/angular-oauth2-oidc/commit/4bf89014d8cc5d50ed716500e3f3ad265b4ae2db">4bf8901</a>)</li>
>>>>>>> c587f55886805c38bd37c52894ef88d88dbf6240
</ul>
<h3 id="bug-fixes">Bug Fixes</h3>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions docs/classes/HashHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ <h3 id="methods">
<div class="tab-pane fade tab-source-code" id="c-source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable } from &#x27;@angular/core&#x27;;

import { sha256 } from &#x27;js-sha256&#x27;;
import { sha256 } from &#x27;./js-sha256&#x27;;

/**
* Abstraction for crypto algorithms
Expand All @@ -222,7 +222,7 @@ <h3 id="methods">
// const hashArray &#x3D; await window.crypto.subtle.digest(algorithm, data);
// const data &#x3D; encoder.encode(valueToHash);

const hashArray &#x3D; sha256.array(valueToHash);
const hashArray &#x3D; (sha256 as any).array(valueToHash);
// const hashString &#x3D; this.toHashString(hashArray);
const hashString &#x3D; this.toHashString2(hashArray);

Expand Down
4 changes: 1 addition & 3 deletions docs/dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
<li>
<b>bootstrap</b> : ^3.3.7</li>
<li>
<b>js-sha256</b> : ^0.9.0</li>
<li>
<b>jsrsasign</b> : ^8.0.12</li>
<b>jsrsasign</b> : ^8.0.19</li>
<li>
<b>ngx-semantic-version</b> : ^1.2.1</li>
<li>
Expand Down
4 changes: 2 additions & 2 deletions docs/injectables/DefaultHashHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ <h3 id="methods">
<div class="tab-pane fade tab-source-code" id="c-source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable } from &#x27;@angular/core&#x27;;

import { sha256 } from &#x27;js-sha256&#x27;;
import { sha256 } from &#x27;./js-sha256&#x27;;

/**
* Abstraction for crypto algorithms
Expand All @@ -351,7 +351,7 @@ <h3 id="methods">
// const hashArray &#x3D; await window.crypto.subtle.digest(algorithm, data);
// const data &#x3D; encoder.encode(valueToHash);

const hashArray &#x3D; sha256.array(valueToHash);
const hashArray &#x3D; (sha256 as any).array(valueToHash);
// const hashString &#x3D; this.toHashString(hashArray);
const hashString &#x3D; this.toHashString2(hashArray);

Expand Down
Loading

0 comments on commit 92ee76d

Please sign in to comment.