<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Hi, Kevin</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I replied to batch mail, so this one went out of context.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><span style="font-family: helvetica, arial;">-- </span></div><div id="bloop_sign_1444013351554563072" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">Tair Sabirgaliev</div><div style="font-family:helvetica,arial;font-size:13px">Bee Software, LLP</div></div> <br><p class="airmail_on">On October 5, 2015 at 08:43:11, Tair Sabirgaliev (<a href="mailto:tair.sabirgaliev@bee.kz">tair.sabirgaliev@bee.kz</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>
<br>Here is what we did for angular 1.4 :
<br>
<br>"use strict";
<br>
<br>var module = angular.module('hello.world', ['ngRoute', 'ngResource']);
<br>
<br>var auth = {};
<br>var logout = function(){
<br> console.log('*** LOGOUT');
<br> auth.loggedIn = false;
<br> auth.authz = null;
<br> window.location = auth.logoutUrl;
<br>};
<br>
<br>angular.element(document).ready(["$http", function ($http) {
<br>
<br> var keycloakAuth = new Keycloak('js/keycloak.json');
<br> auth.loggedIn = false;
<br>
<br>
<br> keycloakAuth.init({ onLoad: 'login-required' }).success(function () {
<br> auth.loggedIn = true;
<br> auth.authz = keycloakAuth;
<br> auth.logoutUrl = keycloakAuth.authServerUrl + "/realms/demo/tokens/logout?redirect_uri=http://localhost:9080/hello-world/";
<br> module.factory('Auth', function() {
<br> return auth;
<br> });
<br> angular.bootstrap(document, ["hello.world"]);
<br>
<br> }).error(function () {
<br> window.location.reload();
<br> });
<br>
<br>}]);
<br>
<br>module.factory('authInterceptor', ["$q", "Auth", function($q, Auth) {
<br> return {
<br> 'request': function (config) {
<br> var deferred = $q.defer();
<br> if (Auth.authz.token) {
<br> Auth.authz.updateToken(5).success(function() {
<br> config.headers = config.headers || {};
<br> config.headers.Authorization = 'Bearer ' + Auth.authz.token;
<br>
<br> deferred.resolve(config);
<br> }).error(function() {
<br> deferred.reject('Failed to refresh token');
<br> });
<br> }
<br> return deferred.promise;
<br> },
<br> 'requestError': function(rejection) {
<br> return $q.reject(rejection);
<br> },
<br>
<br> 'response': function(response) {
<br> return response;
<br> },
<br>
<br> 'responseError': function(response) {
<br>
<br> if (response.status == 401) {
<br> console.log('session timeout?');
<br> logout();
<br> } else if (response.status == 403) {
<br> alert("Forbidden");
<br> } else if (response.status == 404) {
<br> alert("Not found");
<br> } else if (response.status) {
<br> console.log(response.status);
<br> if (response.data && response.data.errorMessage) {
<br> alert(response.data.errorMessage);
<br> } else {
<br> alert("An unexpected server error has occurred");
<br> }
<br> } else if (response === 'Failed to refresh token') {
<br> logout();
<br> }
<br> return $q.reject(response);
<br> }
<br> };
<br>}]);
<br>
<br>module.config(['$httpProvider', function($httpProvider) {
<br> $httpProvider.interceptors.push('authInterceptor');
<br>}]);
<br>
<br>
<br>--
<br>Tair Sabirgaliev
<br>Bee Software, LLP
<br>
<br>
<br>
<br>On October 5, 2015 at 02:57:31, keycloak-user-request@lists.jboss.org (keycloak-user-request@lists.jboss.org(mailto:keycloak-user-request@lists.jboss.org)) wrote:
<br>
<br>> Date: Sat, 3 Oct 2015 20:17:04 +0200(http://airmail.calendar/2015-10-04%2000:17:04%20GMT+6)
<br>> From: "Kevin Hirschmann"
<br>> Subject: [keycloak-user] angularjs example for 1.4
<br>> To: "'keycloak-user'"
<br>> Message-ID: <00cd01d0fe07$b4ab5d60$1e021820$@huebinet.de(mailto:00cd01d0fe07$b4ab5d60$1e021820$@huebinet.de)>
<br>> Content-Type: text/plain; charset="iso-8859-1"
<br>>
<br>> Hello,
<br>>
<br>>
<br>>
<br>> I am trying to use the example provided here
<br>>
<br>>
<br>>
<br>> https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angu
<br>> lar-product-app
<br>>
<br>>
<br>>
<br>> to connect from an angularjs client to a REST Endpoint. Both frontend and
<br>> backend are protected by keycloak.
<br>>
<br>> My problem is, that the example provided by the link above uses angularjs
<br>> 1.2 and doesn?t work with newer versions.
<br>>
<br>> (see
<br>> http://stackoverflow.com/questions/28212837/keycloak-unknown-provider-error)
<br>>
<br>>
<br>>
<br>> Has anyone on the mailing list been able to adapt the example to angular
<br>> 1.4? What steps are necessary?
<br>>
<br>>
<br>>
<br>> Kind Regards
<br>>
<br>>
<br>>
<br>> Kevin Hirschmann
<br>>
<br>>
<br>>
<br>> HUEBINET Informationsmanagement GmbH & Co. KG
<br>>
<br>>
<br>>
<br>>
<br>>
<br>> Der Nachrichtenaustausch mit HUEBINET Informationsmanagement GmbH & Co. KG,
<br>> Koblenz via E-Mail dient lediglich zu Informationszwecken.
<br>> Rechtsgesch?ftliche Erkl?rungen mit verbindlichem Inhalt k?nnen ?ber dieses
<br>> Medium nicht ausgetauscht werden, da die Manipulation von E-Mails durch
<br>> Dritte nicht ausgeschlossen werden kann.
<br>>
<br>>
<br>>
<br>> Email communication with HUEBINET Informationsmanagement GmbH & Co. KG is
<br>> only intended to provide information of a general kind, and shall not be
<br>> used for any statement with binding contents in respect to legal relations.
<br>> It is not totally possible to prevent a third party from manipulating emails
<br>> and email contents.
<br>>
<br>>
<br>>
<br>>
<br>>
<br>>
<br>
<br></div></div></span></blockquote></body></html>