blob: 983ad674d166b5bd5ba4c8b76772fb6b86402436 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>JsonWebToken</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JsonWebToken";
}
}
catch(err) {
}
//-->
var methods = {"i0":18,"i1":18,"i2":18,"i3":6,"i4":6,"i5":18,"i6":18,"i7":18,"i8":18,"i9":6,"i10":18,"i11":18,"i12":18};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/microprofile/jwt/ClaimValue.html" title="interface in org.eclipse.microprofile.jwt"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/microprofile/jwt/JsonWebToken.html" target="_top">Frames</a></li>
<li><a href="JsonWebToken.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.eclipse.microprofile.jwt</div>
<h2 title="Interface JsonWebToken" class="title">Interface JsonWebToken</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd>java.security.Principal</dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">JsonWebToken</span>
extends java.security.Principal</pre>
<div class="block">A read-only interface for the the claims required by Eclipse MicroProfile
conforming tokens. Additional information about the claims defined by OIDC
and RFC7519 can be found at https://www.iana.org/assignments/jwt/jwt.xhtml.
This is compatible with the pre-JSR 375 caller <code>Principal</code> api.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>default &lt;T&gt;&nbsp;java.util.Optional&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#claim-java.lang.String-">claim</a></span>(java.lang.String&nbsp;claimName)</code>
<div class="block">A utility method to access a claim value in an Optional
wrapper</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>default boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#containsClaim-java.lang.String-">containsClaim</a></span>(java.lang.String&nbsp;claimName)</code>
<div class="block">Verify is a given claim exists</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>default java.util.Set&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getAudience--">getAudience</a></span>()</code>
<div class="block">The aud(Audience) claim identifies the recipients that the JWT is
intended for.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getClaim-java.lang.String-">getClaim</a></span>(java.lang.String&nbsp;claimName)</code>
<div class="block">Access the value of the indicated claim.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.util.Set&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getClaimNames--">getClaimNames</a></span>()</code>
<div class="block">Access the names of all claims are associated with this token.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>default long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getExpirationTime--">getExpirationTime</a></span>()</code>
<div class="block">The exp (Expiration time) claim identifies the expiration time on or
after which the JWT MUST NOT be accepted
for processing in seconds since 1970-01-01T00:00:00Z UTC</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>default java.util.Set&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getGroups--">getGroups</a></span>()</code>
<div class="block">The groups claim provides the group names the JWT principal has been
granted.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>default long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getIssuedAtTime--">getIssuedAtTime</a></span>()</code>
<div class="block">The iat(Issued at time) claim identifies the time at which the JWT was
issued in seconds since 1970-01-01T00:00:00Z UTC</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>default java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getIssuer--">getIssuer</a></span>()</code>
<div class="block">The iss(Issuer) claim identifies the principal that issued the JWT</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getName--">getName</a></span>()</code>
<div class="block">Returns the unique name of this principal.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>default java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getRawToken--">getRawToken</a></span>()</code>
<div class="block">Get the raw bearer token string originally passed in the authentication
header</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>default java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getSubject--">getSubject</a></span>()</code>
<div class="block">The sub(Subject) claim identifies the principal that is the subject of
the JWT.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>default java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/jwt/JsonWebToken.html#getTokenID--">getTokenID</a></span>()</code>
<div class="block">The jti(JWT ID) claim provides a unique identifier for the JWT.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.security.Principal">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;java.security.Principal</h3>
<code>equals, hashCode, implies, toString</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getName--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre>java.lang.String&nbsp;getName()</pre>
<div class="block">Returns the unique name of this principal. This either comes from the upn
claim, or if that is missing, the preferred_username claim. Note that for
guaranteed interoperability a upn claim should be used.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>getName</code>&nbsp;in interface&nbsp;<code>java.security.Principal</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the unique name of this principal.</dd>
</dl>
</li>
</ul>
<a name="getRawToken--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRawToken</h4>
<pre>default&nbsp;java.lang.String&nbsp;getRawToken()</pre>
<div class="block">Get the raw bearer token string originally passed in the authentication
header</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>raw bear token string</dd>
</dl>
</li>
</ul>
<a name="getIssuer--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIssuer</h4>
<pre>default&nbsp;java.lang.String&nbsp;getIssuer()</pre>
<div class="block">The iss(Issuer) claim identifies the principal that issued the JWT</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the iss claim.</dd>
</dl>
</li>
</ul>
<a name="getAudience--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAudience</h4>
<pre>default&nbsp;java.util.Set&lt;java.lang.String&gt;&nbsp;getAudience()</pre>
<div class="block">The aud(Audience) claim identifies the recipients that the JWT is
intended for.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the aud claim or null if the claim is not present</dd>
</dl>
</li>
</ul>
<a name="getSubject--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSubject</h4>
<pre>default&nbsp;java.lang.String&nbsp;getSubject()</pre>
<div class="block">The sub(Subject) claim identifies the principal that is the subject of
the JWT. This is the token issuing
IDP subject, not the</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the sub claim.</dd>
</dl>
</li>
</ul>
<a name="getTokenID--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTokenID</h4>
<pre>default&nbsp;java.lang.String&nbsp;getTokenID()</pre>
<div class="block">The jti(JWT ID) claim provides a unique identifier for the JWT.
The identifier value MUST be assigned in a manner that ensures that
there is a negligible probability that the same value will be
accidentally assigned to a different data object; if the application
uses multiple issuers, collisions MUST be prevented among values
produced by different issuers as well. The "jti" claim can be used
to prevent the JWT from being replayed.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the jti claim.</dd>
</dl>
</li>
</ul>
<a name="getExpirationTime--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExpirationTime</h4>
<pre>default&nbsp;long&nbsp;getExpirationTime()</pre>
<div class="block">The exp (Expiration time) claim identifies the expiration time on or
after which the JWT MUST NOT be accepted
for processing in seconds since 1970-01-01T00:00:00Z UTC</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the exp claim.</dd>
</dl>
</li>
</ul>
<a name="getIssuedAtTime--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIssuedAtTime</h4>
<pre>default&nbsp;long&nbsp;getIssuedAtTime()</pre>
<div class="block">The iat(Issued at time) claim identifies the time at which the JWT was
issued in seconds since 1970-01-01T00:00:00Z UTC</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the iat claim</dd>
</dl>
</li>
</ul>
<a name="getGroups--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getGroups</h4>
<pre>default&nbsp;java.util.Set&lt;java.lang.String&gt;&nbsp;getGroups()</pre>
<div class="block">The groups claim provides the group names the JWT principal has been
granted.
This is a MicroProfile specific claim.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a possibly empty set of group names.</dd>
</dl>
</li>
</ul>
<a name="getClaimNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getClaimNames</h4>
<pre>java.util.Set&lt;java.lang.String&gt;&nbsp;getClaimNames()</pre>
<div class="block">Access the names of all claims are associated with this token.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>non-standard claim names in the token</dd>
</dl>
</li>
</ul>
<a name="containsClaim-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>containsClaim</h4>
<pre>default&nbsp;boolean&nbsp;containsClaim(java.lang.String&nbsp;claimName)</pre>
<div class="block">Verify is a given claim exists</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>claimName</code> - - the name of the claim</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the JsonWebToken contains the claim, false otherwise</dd>
</dl>
</li>
</ul>
<a name="getClaim-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getClaim</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;getClaim(java.lang.String&nbsp;claimName)</pre>
<div class="block">Access the value of the indicated claim.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>claimName</code> - - the name of the claim</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value of the indicated claim if it exists, null otherwise.</dd>
</dl>
</li>
</ul>
<a name="claim-java.lang.String-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>claim</h4>
<pre>default&nbsp;&lt;T&gt;&nbsp;java.util.Optional&lt;T&gt;&nbsp;claim(java.lang.String&nbsp;claimName)</pre>
<div class="block">A utility method to access a claim value in an Optional
wrapper</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - - the type of the claim value to return</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>claimName</code> - - the name of the claim</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an Optional wrapper of the claim value</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/microprofile/jwt/ClaimValue.html" title="interface in org.eclipse.microprofile.jwt"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/microprofile/jwt/JsonWebToken.html" target="_top">Frames</a></li>
<li><a href="JsonWebToken.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>