So here is my branch with some changes (but - disclaimer-  it's still not working but will maybe help to make progress) : https://github.com/sebastienblanc/aerogear-unified-push-server/tree/keycloak_angular_integration

The problem is now on the server side,   this give a NPE : 
https://github.com/sebastienblanc/aerogear-unified-push-server/blob/keycloak_angular_integration/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/applications/PushApplicationEndpoint.java#L78

So basically, in the request we don't have the UserPrincipal but from the client I can see an Authorization header : 

  1. GET /ag-push/rest/applications HTTP/1.1 Host: localhost:8080 Connection: keep-alive Cache-Control: max-age=0 Accept: application/json, text/plain, */* User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36 Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiIxNTk5MzBmNi05NDI4LTQxM2EtYTExZi00MjA3MzY5ZTMyOGYiLCJleHAiOjE0MDIyMjI2MDEsIm5iZiI6MCwiaWF0IjoxNDAyMjE5NjAxLCJpc3MiOiJhZXJvZ2VhciIsImF1ZCI6ImFlcm9nZWFyIiwic3ViIjoiOWFlOTE3ZTItMTViZi00MzhmLThlYzctMGE5YzBkM2RkNzlhIiwiYXpwIjoidW5pZmllZC1wdXNoLXNlcnZlciIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwic2Vzc2lvbl9zdGF0ZSI6IjJmNzkzNjQ2LWFmYjUtNDdkOC1hMmNmLWM1MDJjNThmMTQzMiIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJhZG1pbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7fX0.Vk8_RJOnzh1tvWxHCLu5WTyOdy84LU1QwclCq4NRTqDL-82B-X1CuJVVnxr3abqgdRZbtvVIgEDeQvnYXLKYmLSCsT-PtJl54AQc72GRRDplyVkaGlw1Vcg-eNGwnyy6jnYusmumuf_24H0DaxXWITXi-GKRoW4cVn7lEwqgF_k Referer: http://localhost:8080/ag-push/?redirect_fragment=/main&code=eyJhbGciOiJSUzI1NiJ9.ZGE3ZTYzNWEtZTYxYi00Y2ViLTg1OWMtMDBkMDU2YjlkMjdmMTQwMjIxOTYwMTAzMg.aQ9hBljDqFchGzkblFrYQ2E_Ax8kh-P4r7Ctz8oPx4dCKVpRM0zmxYkpC_0ALEzPHXS6AKv58MQTXM55_8yUxk15AC9-foCvrYZvPrFqNL4c_GQm5P4KivP6t-RNS0pg63zziM3QNLq9aOVeoFnm5fZU5i0ZGvzT8edzFHmYlds&state=e2918ebe-e5b8-46d5-823e-e727b2ea18bd Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,fr;q=0.6 Cookie: JSESSIONID=nBxjj-qL3YRjCtxKKyMutHPQ.undefined




On Sat, Jun 7, 2014 at 11:29 AM, Sebastien Blanc <scm.blanc@gmail.com> wrote:
Hi my friend ! 

Just to let you know I started to look at your branch and indeed you better not be epileptic to survive the crazy reloads ;)
I have nothing to push right now but I have some ideas : 

* Like you mention, the redirect and main route broke the stuff. So, I think we should remove that and do the initial redirect in the success callback of the keycloakAuth.init call. I have a local branch where I manage to do that, but it's really hacky and I face another issue , the first next REST call fails because there are not auth info. But ! This is there where we have to introduce the Auth interceptor like here https://github.com/keycloak/keycloak/blob/master/examples/demo-template/angular-product-app/src/main/webapp/js/app.js#L43-L60

I think based on this, we should be able to find a solution. I will try to push my work ASAP and maybe some dudes for KC could give us some hints as well.

Have a good weekend ! 

sebi 



On Fri, Jun 6, 2014 at 6:05 PM, Bruno Oliveira <bruno@abstractj.org> wrote:
Good morning,

I'm struggling to integrate Keycloak.js with our admin-ui. Everything
works perfectly well out of admin-ui with UPS and Angular.js as you
might notice here:
https://github.com/abstractj/aerogear-unifiedpush-server/tree/keycloak-angular

The issue lies when I enable the routes related with redirect and
MainController:
https://github.com/abstractj/aerogear-unifiedpush-server/tree/keycloak_angular_integration.
Just open http://localhost:8080/ag-push and watch your browser reload
like crazy. When the main route and redirect are disable, everything goes
well:
https://github.com/abstractj/aerogear-unifiedpush-server/commit/dd9438c6503061fba8aa0e0d77973971888e9379


At first glance it doesn't sound to be a problem on KC.js, once already works with Angular.js:
https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angular-product-app.

If you have any idea, help is appreciated.

--

abstractj
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev