<div dir="ltr"><div><div>Great! I'm looking forward to see keycloak Alpha 3 release :D</div></div><div><br></div><div>Thank you guys.</div><div><br></div><div>Rodrigo. </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Mar 10, 2014 at 10:38 AM, Bill Burke <span dir="ltr"><<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wrote some docs for it, but won't be published until Alpha 3<br>
<div class="HOEnZb"><div class="h5"><br>
On 3/10/2014 10:34 AM, Stian Thorgersen wrote:<br>
> Hi,<br>
><br>
> We have a JS library, it's available at <a href="http://localhost:8080/js/keycloak.js" target="_blank">http://localhost:8080/js/keycloak.js</a>. There's no documentation for it yet, and the example needs a bit of TLC, but the example is customer-app-js and will be included in the alpha3 downloads that is due this week.<br>
><br>
> A quick overview to get you started:<br>
><br>
> Keycloak constructor takes a single object with the following properties:<br>
><br>
> * client_id (required) - the name of the application/client in the admin console<br>
> * client_secret (optional) - not recommended, instead select public client option for your application/client in the admin console<br>
> * realm (required)<br>
> * url (optional) - the base url of the server, if not specified it will infer it from the url of the keycloak.js script<br>
> * onload (optional) - valid options: login-required, check-sso. Login required will redirect to login form when init is called. Check-sso will also redirect to login form, but won't display login form (used to check if user is logged into to sso realm)<br>
><br>
> For example:<br>
><br>
> var keycloak = Keycloak({ client_id: 'myapp', realm: 'myrealm' })<br>
> keycloak.init(function() { alert('authenticated') }, function() { alert('auth failed') } );<br>
><br>
> Addition methods:<br>
><br>
> * login - redirect to login form<br>
> * logout - log out<br>
> * hasRealmRole(role) - returns true if user has the realm role<br>
> * hasResourceRole(role, resource) - return true if user has the role for the specified resource (application)<br>
> * loadUserProfile(success, failure) - loads the profile (in the future profile will be retrieved with IDToken from OpenID Connect spec, so this will probably not be required)<br>
> * onValidAccessToken(success, failure) - invoke methods with a valid token. If the token is expired the refresh token is used to retrieve a new token before invoking the success callback<br>
><br>
> Once authenticated the following properties are available as well:<br>
><br>
> * token - base64 encoded token (use this as the value for the 'Authorization' header, for example "xMLHttpRequest.setRequestHeader('Authorization', 'Bearer ' + keycloak.token)")<br>
> * tokenParsed - parsed token<br>
> * authenticated - true if authenticated, false otherwise<br>
> * subject - userId<br>
><br>
> Please let me know how you get on with it, any feedback would be appreciated.<br>
><br>
> Cheers,<br>
> Stian<br>
><br>
><br>
> ----- Original Message -----<br>
>> From: "Rodrigo Del Canto" <<a href="mailto:delkant@gmail.com">delkant@gmail.com</a>><br>
>> To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
>> Sent: Saturday, 8 March, 2014 5:54:44 AM<br>
>> Subject: [keycloak-user] External JS AJAX client for jax-rs backend API<br>
>><br>
>> Hello guys,<br>
>><br>
>> Congrats on the release of project! I think this is the most useful project<br>
>> for developers in the whole history of internet :D<br>
>><br>
>> I would like to know if you have any example on how to perform a login from<br>
>> an external JavaScript client?<br>
>><br>
>> How would you recommend to do this. I heard you have a JS/jQuery lib to do<br>
>> this, where can it be found?<br>
>><br>
>> Thanks,<br>
>><br>
>> delkant<br>
>><br>
>> _______________________________________________<br>
>> keycloak-user mailing list<br>
>> <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
> _______________________________________________<br>
> keycloak-user mailing list<br>
> <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Bill Burke<br>
JBoss, a division of Red Hat<br>
<a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
</div></div></blockquote></div><br></div>