<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://ess-wiki.advantech.com.tw/wiki/index.php?action=history&amp;feed=atom&amp;title=Resource_Server_jwt_Sample_code</id>
		<title>Resource Server jwt Sample code - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://ess-wiki.advantech.com.tw/wiki/index.php?action=history&amp;feed=atom&amp;title=Resource_Server_jwt_Sample_code"/>
		<link rel="alternate" type="text/html" href="https://ess-wiki.advantech.com.tw/wiki/index.php?title=Resource_Server_jwt_Sample_code&amp;action=history"/>
		<updated>2026-04-10T16:51:57Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.3</generator>

	<entry>
		<id>https://ess-wiki.advantech.com.tw/wiki/index.php?title=Resource_Server_jwt_Sample_code&amp;diff=5207&amp;oldid=prev</id>
		<title>Jonathan.lin at 08:46, 17 January 2017</title>
		<link rel="alternate" type="text/html" href="https://ess-wiki.advantech.com.tw/wiki/index.php?title=Resource_Server_jwt_Sample_code&amp;diff=5207&amp;oldid=prev"/>
				<updated>2017-01-17T08:46:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 08:46, 17 January 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Maven Dependency&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Restful API for idTokenString from Openid Server&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code data-lang&lt;/del&gt;=&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;dependencies&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Base64.Decoder decoder &lt;/ins&gt;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Base64&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;getDecoder();&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;lt;dependency&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;String[]&amp;amp;nbsp; tokenParts&amp;amp;nbsp; &lt;/ins&gt;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;idTokenString.split(&lt;/ins&gt;&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;\\.&lt;/ins&gt;&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;lt;groupId&amp;gt;org&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;keycloak&amp;lt;/groupId&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;String tokenpayload &lt;/ins&gt;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;new String(decoder&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;decode&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;tokenParts[1]), &amp;quot;UTF-8&amp;quot;&lt;/ins&gt;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;lt;artifactId&amp;gt;keycloak-authz-client&amp;lt;/artifactId&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;JSONObject jsonObj &lt;/ins&gt;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;new JSONObject&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;tokenpayload&lt;/ins&gt;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;lt;version&amp;gt;${KEYCLOAK_VERSION}&amp;lt;/version&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;String username &lt;/ins&gt;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;jsonObj&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;getJSONObject&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;name&amp;quot;&lt;/ins&gt;).&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;toString&lt;/ins&gt;();&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;lt;/dependency&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;String &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;email &lt;/ins&gt;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;jsonObj&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;getJSONObject&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;email&amp;quot;&lt;/ins&gt;).&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;toString&lt;/ins&gt;();&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/dependencies&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;*Obtaining User Entitlements&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&amp;lt;code data-lang&lt;/del&gt;=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;java&lt;/del&gt;&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;// create a new instance based on the configuration defined in keycloak-authz.json&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;AuthzClient authzClient &lt;/del&gt;= &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;AuthzClient&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;create&lt;/del&gt;();&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// obtain an Entitlement API Token to get access to the Entitlement API.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// this token is an access token issued to a client on behalf of an user&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// with a scope &lt;/del&gt;= &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kc_entitlement&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;String eat = getEntitlementAPIToken&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;authzClient&lt;/del&gt;);&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// send the entitlement request to the server to&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// obtain an RPT with all permissions granted to the user&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;EntitlementResponse response &lt;/del&gt;= &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;authzClient&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;entitlement&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;eat&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;getAll&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;hello-world-authz-service&amp;quot;&lt;/del&gt;);&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;String &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;rpt &lt;/del&gt;= &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;response&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;getRpt&lt;/del&gt;()&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;System&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;out.println&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;You got a RPT: &amp;quot; + rpt&lt;/del&gt;);&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// now you can use the RPT to access protected resources on the resource server&amp;lt;/code&amp;gt;&lt;/del&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jonathan.lin</name></author>	</entry>

	<entry>
		<id>https://ess-wiki.advantech.com.tw/wiki/index.php?title=Resource_Server_jwt_Sample_code&amp;diff=5137&amp;oldid=prev</id>
		<title>Dylan.chang: Created page with &quot;*Maven Dependency &lt;pre&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;dependencies&gt;     &lt;dependency&gt;         &lt;groupId&gt;org.keycloak&lt;/groupId&gt;         &lt;artifactId&gt;keycloak-authz-client&lt;/artifactId&gt;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://ess-wiki.advantech.com.tw/wiki/index.php?title=Resource_Server_jwt_Sample_code&amp;diff=5137&amp;oldid=prev"/>
				<updated>2017-01-16T06:27:13Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;*Maven Dependency &amp;lt;pre&amp;gt;&amp;lt;code data-lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;dependencies&amp;gt;     &amp;lt;dependency&amp;gt;         &amp;lt;groupId&amp;gt;org.keycloak&amp;lt;/groupId&amp;gt;         &amp;lt;artifactId&amp;gt;keycloak-authz-client&amp;lt;/artifactId&amp;gt;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;*Maven Dependency&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;code data-lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;dependencies&amp;gt;&lt;br /&gt;
    &amp;lt;dependency&amp;gt;&lt;br /&gt;
        &amp;lt;groupId&amp;gt;org.keycloak&amp;lt;/groupId&amp;gt;&lt;br /&gt;
        &amp;lt;artifactId&amp;gt;keycloak-authz-client&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
        &amp;lt;version&amp;gt;${KEYCLOAK_VERSION}&amp;lt;/version&amp;gt;&lt;br /&gt;
    &amp;lt;/dependency&amp;gt;&lt;br /&gt;
&amp;lt;/dependencies&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Obtaining User Entitlements&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;code data-lang=&amp;quot;java&amp;quot;&amp;gt;// create a new instance based on the configuration defined in keycloak-authz.json&lt;br /&gt;
AuthzClient authzClient = AuthzClient.create();&lt;br /&gt;
&lt;br /&gt;
// obtain an Entitlement API Token to get access to the Entitlement API.&lt;br /&gt;
// this token is an access token issued to a client on behalf of an user&lt;br /&gt;
// with a scope = kc_entitlement&lt;br /&gt;
String eat = getEntitlementAPIToken(authzClient);&lt;br /&gt;
&lt;br /&gt;
// send the entitlement request to the server to&lt;br /&gt;
// obtain an RPT with all permissions granted to the user&lt;br /&gt;
EntitlementResponse response = authzClient.entitlement(eat)&lt;br /&gt;
    .getAll(&amp;quot;hello-world-authz-service&amp;quot;);&lt;br /&gt;
String rpt = response.getRpt();&lt;br /&gt;
&lt;br /&gt;
System.out.println(&amp;quot;You got a RPT: &amp;quot; + rpt);&lt;br /&gt;
&lt;br /&gt;
// now you can use the RPT to access protected resources on the resource server&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dylan.chang</name></author>	</entry>

	</feed>