Hi,

I have the war file of service bearer only application in jboss deployments folder, the auth-server.war for keycloak is also at the same location.

Roles configured:-
Inline image 1

Here' my web.xml for service bearer only application:-

Inline image 2

Here's the setting for the bearer only application in keycloak

Inline image 3

User Role Mappings

Inline image 1

I am using REST services to fulfill the request. Here's a snippet of code:-

KeycloakSecurityContext securityContext = (KeycloakSecurityContext) httpRequest
.getAttribute(KeycloakSecurityContext.class.getName());
AccessToken accessToken = securityContext.getToken();


OAuth Client Scope Mappings:-

Inline image 2


Please let me know, if any more information is required.


Regards,
Arjit Agrawal


On Thu, Jun 4, 2015 at 6:02 PM, Stian Thorgersen <stian@redhat.com> wrote:
We'll need much more info here. How have you secured the app? Is it a WAR? Do you require any roles for the resource you're invoking? Are you sending a bearer token with the request? How do you get the request? Does the user have the required roles? Does the client have the required scope?

----- Original Message -----
> From: "Arjit Agrawal" <arjit.agrawal.07@gmail.com>
> To: "keycloak-user" <keycloak-user@lists.jboss.org>
> Sent: Thursday, 4 June, 2015 5:49:08 AM
> Subject: [keycloak-user] HTTP 403 Forbidden while connecting to bearer only   application
>
> Hi,
>
> I have a new application - 'testapi' under a new realm - 'testrealm'. This
> application is to be used as an API. Its an bearer only application .
>
> I have also made an OAuth Client to access this service.
>
> I am using iOS AeroGear plugin in my project to connect to API service with
> all the required creditionals like clientId, roles etc.
>
> Version of Keycloak - 1.0-beta3 .
> Version of Jboss - JBoss AS 7.1.1
>
> Its hosted on Amazon AWS . (I tried the same in my local environment it was
> working but when i have done the same on Amazon server, i am getting this
> issue.)
>
>
> Thanks for any help on this one.
>
> Regards,
> Arjit Agrawal
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user



--
Arjit Agrawal
AKGEC, Ghaziabad