Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Aug 28, 2017
1 parent 91fa005 commit f9c6efe
Show file tree
Hide file tree
Showing 26 changed files with 2,821 additions and 463 deletions.
15 changes: 11 additions & 4 deletions angular-oauth2-oidc/docs/classes/AbstractValidationHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -366,6 +369,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -481,7 +487,7 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="86" class="link-to-prism">src/token-validation/validation-handler.ts:86</a></div>
<div class="io-line">Defined in <a href="" data-line="87" class="link-to-prism">src/token-validation/validation-handler.ts:87</a></div>
</td>
</tr>

Expand Down Expand Up @@ -548,7 +554,7 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="69" class="link-to-prism">src/token-validation/validation-handler.ts:69</a></div>
<div class="io-line">Defined in <a href="" data-line="70" class="link-to-prism">src/token-validation/validation-handler.ts:70</a></div>
</td>
</tr>

Expand Down Expand Up @@ -609,7 +615,7 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="41" class="link-to-prism">src/token-validation/validation-handler.ts:41</a></div>
<div class="io-line">Defined in <a href="" data-line="42" class="link-to-prism">src/token-validation/validation-handler.ts:42</a></div>
</td>
</tr>

Expand Down Expand Up @@ -644,7 +650,7 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="36" class="link-to-prism">src/token-validation/validation-handler.ts:36</a></div>
<div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/token-validation/validation-handler.ts:37</a></div>
</td>
</tr>

Expand Down Expand Up @@ -674,6 +680,7 @@ <h3 id="methods">
idTokenHeader: object;
idTokenClaims: object;
jwks: object;
loadKeys: () &#x3D;&gt; Promise&lt;object&gt;;
}

/**
Expand Down
104 changes: 91 additions & 13 deletions angular-oauth2-oidc/docs/classes/JwksValidationHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -366,6 +369,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -455,6 +461,9 @@ <h6><b>Methods</b></h6>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Private</span> <a href="#alg2kty">alg2kty</a>
</li>
<li>
<a href="#calcHash">calcHash</a>
</li>
Expand All @@ -477,6 +486,39 @@ <h6><b>Methods</b></h6>
<h3 id="methods">
Methods
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="alg2kty"></a>
<b><span class="modifier">Private</span> alg2kty</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon method fa fa-play lock"></span>
<code>alg2kty(alg: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
</td>
</tr>


<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="99" class="link-to-prism">src/token-validation/jwks-validation-handler.ts:99</a></div>
</td>
</tr>

<tr>
<td class="col-md-4">

<div class="io-description">
<b>Returns : </b> <code>&quot;RSA&quot; | &quot;EC&quot;</code>

</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
Expand All @@ -494,7 +536,7 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="71" class="link-to-prism">src/token-validation/jwks-validation-handler.ts:71</a></div>
<div class="io-line">Defined in <a href="" data-line="107" class="link-to-prism">src/token-validation/jwks-validation-handler.ts:107</a></div>
</td>
</tr>

Expand Down Expand Up @@ -526,7 +568,7 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="78" class="link-to-prism">src/token-validation/jwks-validation-handler.ts:78</a></div>
<div class="io-line">Defined in <a href="" data-line="114" class="link-to-prism">src/token-validation/jwks-validation-handler.ts:114</a></div>
</td>
</tr>

Expand All @@ -551,7 +593,7 @@ <h3 id="methods">
</tr>
<tr>
<td class="col-md-4">
<code>validateSignature(params: <a href="../interfaces/ValidationParams.html">ValidationParams</a>)</code>
<code>validateSignature(params: <a href="../interfaces/ValidationParams.html">ValidationParams</a>, retry: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank">boolean</a>)</code>
</td>
</tr>

Expand Down Expand Up @@ -686,7 +728,7 @@ <h3 id="inputs">
*/
gracePeriodInSec: number &#x3D; 600;

validateSignature(params: ValidationParams): Promise&lt;any&gt; {
validateSignature(params: ValidationParams, retry: boolean &#x3D; false): Promise&lt;any&gt; {
if (!params.idToken) throw new Error(&#x27;Parameter idToken expected!&#x27;);
if (!params.idTokenHeader) throw new Error(&#x27;Parameter idTokenHandler expected.&#x27;);
if (!params.jwks) throw new Error(&#x27;Parameter jwks expected!&#x27;);
Expand All @@ -695,23 +737,51 @@ <h3 id="inputs">
throw new Error(&#x27;Array keys in jwks missing!&#x27;);
}

console.debug(&#x27;validateSignature: retry&#x27;, retry);

let kid: string &#x3D; params.idTokenHeader[&#x27;kid&#x27;];
let keys: object[] &#x3D; params.jwks[&#x27;keys&#x27;];
let key: object;

if (!kid &amp;&amp; params.jwks[&#x27;keys&#x27;].length &gt; 1) {
let error &#x3D; &#x27;Multiple keys but no kid in token!&#x27;;
console.error(error);
return Promise.reject(error);
}
else if (!kid) {
key &#x3D; params.jwks[&#x27;keys&#x27;][0];
let alg &#x3D; params.idTokenHeader[&#x27;alg&#x27;];

if (kid) {
key &#x3D; keys.find(k &#x3D;&gt; k[&#x27;kid&#x27;] &#x3D;&#x3D; kid &amp;&amp; k[&#x27;use&#x27;] &#x3D;&#x3D; &#x27;sig&#x27;);
}
else {
key &#x3D; keys.find(k &#x3D;&gt; k[&#x27;kid&#x27;] &#x3D;&#x3D; kid &amp;&amp; k[&#x27;use&#x27;] &#x3D;&#x3D; &#x27;sig&#x27;);
let kty &#x3D; this.alg2kty(alg)
let matchingKeys &#x3D; keys.filter(k &#x3D;&gt; k[&#x27;kty&#x27;] &#x3D;&#x3D; kty &amp;&amp; k[&#x27;use&#x27;] &#x3D;&#x3D; &#x27;sig&#x27;);

/*
if (matchingKeys.length &#x3D;&#x3D; 0) {
let error &#x3D; &#x27;No matching key found.&#x27;;
console.error(error);
return Promise.reject(error);
}*/
if (matchingKeys.length &gt; 1) {
let error &#x3D; &#x27;More than one matching key found. Please specify a kid in the id_token header.&#x27;;
console.error(error);
return Promise.reject(error);
}
else if (matchingKeys.length &#x3D;&#x3D; 1) {
key &#x3D; matchingKeys[0];
}
}

if (!key) {
if (!key &amp;&amp; !retry &amp;&amp; params.loadKeys) {
return params
.loadKeys()
.then(keys &#x3D;&gt; params.jwks &#x3D; keys)
.then(_ &#x3D;&gt; this.validateSignature(params, true));
}

if (!key &amp;&amp; retry &amp;&amp; !kid) {
let error &#x3D; &#x27;No matching key found.&#x27;;
console.error(error);
return Promise.reject(error);
}

if (!key &amp;&amp; retry &amp;&amp; kid) {
let error &#x3D; &#x27;expected key not found in property jwks. &#x27;
+ &#x27;This property is most likely loaded with the &#x27;
+ &#x27;discovery document. &#x27;
Expand All @@ -732,6 +802,14 @@ <h3 id="inputs">
}
}

private alg2kty(alg: string) {
switch(alg.charAt(0)) {
case &#x27;R&#x27;: return &#x27;RSA&#x27;;
case &#x27;E&#x27;: return &#x27;EC&#x27;;
default: throw new Error(&#x27;Cannot infer kty from alg: &#x27; + alg);
}
}

calcHash(valueToHash: string, algorithm: string): string {
let hashAlg &#x3D; new rs.KJUR.crypto.MessageDigest({alg: algorithm});
let result &#x3D; hashAlg.digestString(valueToHash);
Expand Down
59 changes: 59 additions & 0 deletions angular-oauth2-oidc/docs/classes/LoginOptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -366,6 +369,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -433,6 +439,9 @@ <h6><b>Properties</b></h6>
<li>
<a href="#customHashFragment">customHashFragment</a>
</li>
<li>
<a href="#disableOAuth2StateCheck">disableOAuth2StateCheck</a>
</li>
<li>
<a href="#onLoginError">onLoginError</a>
</li>
Expand Down Expand Up @@ -488,6 +497,46 @@ <h3 id="inputs">
<div class="io-description"><p>A custom hash fragment to be used instead of the
actual one. This is used for silent refreshes, to
pass the iframes hash fragment to this method.</p>
</div>
</td>
</tr>

</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="disableOAuth2StateCheck"></a>
<b> disableOAuth2StateCheck</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>disableOAuth2StateCheck: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>

</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="43" class="link-to-prism">src/types.ts:43</a></div>
</td>
</tr>

<tr>
<td class="col-md-4">
<div class="io-description"><p>Set this to true to disable the oauth2 state
check which is a best practice to avoid
security attacks.
As OIDC defines a nonce check that includes
this, this can be set to true when only doing
OIDC.</p>
</div>
</td>
</tr>
Expand Down Expand Up @@ -639,6 +688,16 @@ <h3 id="inputs">
* pass the iframes hash fragment to this method.
*/
customHashFragment?: string;

/**
* Set this to true to disable the oauth2 state
* check which is a best practice to avoid
* security attacks.
* As OIDC defines a nonce check that includes
* this, this can be set to true when only doing
* OIDC.
*/
disableOAuth2StateCheck?: boolean;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions angular-oauth2-oidc/docs/classes/NullValidationHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -366,6 +369,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down
6 changes: 6 additions & 0 deletions angular-oauth2-oidc/docs/classes/OAuthErrorEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -366,6 +369,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down
6 changes: 6 additions & 0 deletions angular-oauth2-oidc/docs/classes/OAuthEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down Expand Up @@ -366,6 +369,9 @@
</li>


<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>


</ul>
Expand Down
Loading

0 comments on commit f9c6efe

Please sign in to comment.