<div dir="ltr">Hi,<div><br></div><div>I'm trying to secure a bearer-only application with keycloak, to access it with access tokens, but I think I'm missing something.</div><div><br></div><div>I tried it with the <font face="courier new, monospace">database-service</font> of the unconfigured demo.</div>
<div><br></div><div>1. I created the user role in the application.</div><div>2. I assigned that role to my user</div><div>3. I copied the contents of the installation json to <font face="courier new, monospace"><b>webapp/META-INF/keycloak.json</b></font></div>
<div><br></div><div><div><font face="courier new, monospace" color="#444444">{</font></div><div><font face="courier new, monospace" color="#444444"> "realm": "demo",</font></div><div><font face="courier new, monospace" color="#444444"> "realm-public-key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwRayjzh7W+EfPaeSdyXWLyXof7c3fwD7vb0AEtG+ogLHtMkYiTdX9y/JXOmXwWDzGhx7NM3Q6vkCG0F3lZqOVsSlYH56c5+Ev4QmSGK/+6e+WcZMcgmscoz1OoXKom4+pzqMey42hqdwwMhkvCq/jxJSmUGnZJQuqEKVH00NZ1wIDAQAB",</font></div>
<div><font face="courier new, monospace" color="#444444"> "bearer-only": true,</font></div><div><font face="courier new, monospace" color="#444444"> "ssl-not-required": true,</font></div><div><font face="courier new, monospace" color="#444444"> "resource": "database-service",</font></div>
<div><font face="courier new, monospace" color="#444444"> "use-resource-role-mappings": true</font></div><div><font face="courier new, monospace" color="#444444">}</font></div><div><br></div><div>4. Set the <font face="courier new, monospace">auth-method</font> to <b>KEYCLOAK</b> on <font face="courier new, monospace">web.xml</font></div>
<div>5. Started the server deploying the <font face="courier new, monospace"><b>database-service</b></font></div><div>6. Generated a token using <font face="courier new, monospace"><b>security-admin-console</b></font> client_id and my user</div>
<div>7. Submitted a GET request to <i><font face="courier new, monospace">localhost:8080/database/customers</font></i></div><div><br></div><div>After these steps I get a 403 error, saying that I'm not authorized to access the resource, wasn't this supposed to work?</div>
<div><br></div>-- <br><div dir="ltr"><font face="Times New Roman">Rodrigo Sasaki</font><div></div></div>
</div></div>