KEYCLOAK-1385 Introduce end-of-line normalization
This commit is contained in:
1 parent
be8aa93cca
commit
1642ac2394
888 files changed
+110680
-110660
No files matched your search
@@ -1,36 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>keycloak-examples-demo-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>1.4.0.Final-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.keycloak.example.demo</groupId>
|
||||
<artifactId>angular-product-example</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Angular Product Portal JS</name>
|
||||
<description/>
|
||||
|
||||
<build>
|
||||
<finalName>angular-product</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jboss.as.plugins</groupId>
|
||||
<artifactId>jboss-as-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wildfly.plugins</groupId>
|
||||
<artifactId>wildfly-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>keycloak-examples-demo-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>1.4.0.Final-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.keycloak.example.demo</groupId>
|
||||
<artifactId>angular-product-example</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Angular Product Portal JS</name>
|
||||
<description/>
|
||||
|
||||
<build>
|
||||
<finalName>angular-product</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jboss.as.plugins</groupId>
|
||||
<artifactId>jboss-as-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wildfly.plugins</groupId>
|
||||
<artifactId>wildfly-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,93 +1,93 @@
|
||||
var module = angular.module('product', []);
|
||||
|
||||
var auth = {};
|
||||
var logout = function(){
|
||||
console.log('*** LOGOUT');
|
||||
auth.loggedIn = false;
|
||||
auth.authz = null;
|
||||
window.location = auth.logoutUrl;
|
||||
};
|
||||
|
||||
|
||||
angular.element(document).ready(function ($http) {
|
||||
var keycloakAuth = new Keycloak('keycloak.json');
|
||||
auth.loggedIn = false;
|
||||
|
||||
keycloakAuth.init({ onLoad: 'login-required' }).success(function () {
|
||||
auth.loggedIn = true;
|
||||
auth.authz = keycloakAuth;
|
||||
auth.logoutUrl = keycloakAuth.authServerUrl + "/realms/demo/tokens/logout?redirect_uri=/angular-product/index.html";
|
||||
module.factory('Auth', function() {
|
||||
return auth;
|
||||
});
|
||||
angular.bootstrap(document, ["product"]);
|
||||
}).error(function () {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
module.controller('GlobalCtrl', function($scope, $http) {
|
||||
$scope.products = [];
|
||||
$scope.reloadData = function() {
|
||||
$http.get("/database/products").success(function(data) {
|
||||
$scope.products = angular.fromJson(data);
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
$scope.logout = logout;
|
||||
});
|
||||
|
||||
|
||||
module.factory('authInterceptor', function($q, Auth) {
|
||||
return {
|
||||
request: function (config) {
|
||||
var deferred = $q.defer();
|
||||
if (Auth.authz.token) {
|
||||
Auth.authz.updateToken(5).success(function() {
|
||||
config.headers = config.headers || {};
|
||||
config.headers.Authorization = 'Bearer ' + Auth.authz.token;
|
||||
|
||||
deferred.resolve(config);
|
||||
}).error(function() {
|
||||
deferred.reject('Failed to refresh token');
|
||||
});
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
module.config(function($httpProvider) {
|
||||
$httpProvider.responseInterceptors.push('errorInterceptor');
|
||||
$httpProvider.interceptors.push('authInterceptor');
|
||||
|
||||
});
|
||||
|
||||
module.factory('errorInterceptor', function($q) {
|
||||
return function(promise) {
|
||||
return promise.then(function(response) {
|
||||
return response;
|
||||
}, function(response) {
|
||||
if (response.status == 401) {
|
||||
console.log('session timeout?');
|
||||
logout();
|
||||
} else if (response.status == 403) {
|
||||
alert("Forbidden");
|
||||
} else if (response.status == 404) {
|
||||
alert("Not found");
|
||||
} else if (response.status) {
|
||||
if (response.data && response.data.errorMessage) {
|
||||
alert(response.data.errorMessage);
|
||||
} else {
|
||||
alert("An unexpected server error has occurred");
|
||||
}
|
||||
}
|
||||
return $q.reject(response);
|
||||
});
|
||||
};
|
||||
});
|
||||
var module = angular.module('product', []);
|
||||
|
||||
var auth = {};
|
||||
var logout = function(){
|
||||
console.log('*** LOGOUT');
|
||||
auth.loggedIn = false;
|
||||
auth.authz = null;
|
||||
window.location = auth.logoutUrl;
|
||||
};
|
||||
|
||||
|
||||
angular.element(document).ready(function ($http) {
|
||||
var keycloakAuth = new Keycloak('keycloak.json');
|
||||
auth.loggedIn = false;
|
||||
|
||||
keycloakAuth.init({ onLoad: 'login-required' }).success(function () {
|
||||
auth.loggedIn = true;
|
||||
auth.authz = keycloakAuth;
|
||||
auth.logoutUrl = keycloakAuth.authServerUrl + "/realms/demo/tokens/logout?redirect_uri=/angular-product/index.html";
|
||||
module.factory('Auth', function() {
|
||||
return auth;
|
||||
});
|
||||
angular.bootstrap(document, ["product"]);
|
||||
}).error(function () {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
module.controller('GlobalCtrl', function($scope, $http) {
|
||||
$scope.products = [];
|
||||
$scope.reloadData = function() {
|
||||
$http.get("/database/products").success(function(data) {
|
||||
$scope.products = angular.fromJson(data);
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
$scope.logout = logout;
|
||||
});
|
||||
|
||||
|
||||
module.factory('authInterceptor', function($q, Auth) {
|
||||
return {
|
||||
request: function (config) {
|
||||
var deferred = $q.defer();
|
||||
if (Auth.authz.token) {
|
||||
Auth.authz.updateToken(5).success(function() {
|
||||
config.headers = config.headers || {};
|
||||
config.headers.Authorization = 'Bearer ' + Auth.authz.token;
|
||||
|
||||
deferred.resolve(config);
|
||||
}).error(function() {
|
||||
deferred.reject('Failed to refresh token');
|
||||
});
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
module.config(function($httpProvider) {
|
||||
$httpProvider.responseInterceptors.push('errorInterceptor');
|
||||
$httpProvider.interceptors.push('authInterceptor');
|
||||
|
||||
});
|
||||
|
||||
module.factory('errorInterceptor', function($q) {
|
||||
return function(promise) {
|
||||
return promise.then(function(response) {
|
||||
return response;
|
||||
}, function(response) {
|
||||
if (response.status == 401) {
|
||||
console.log('session timeout?');
|
||||
logout();
|
||||
} else if (response.status == 403) {
|
||||
alert("Forbidden");
|
||||
} else if (response.status == 404) {
|
||||
alert("Not found");
|
||||
} else if (response.status) {
|
||||
if (response.data && response.data.errorMessage) {
|
||||
alert(response.data.errorMessage);
|
||||
} else {
|
||||
alert("An unexpected server error has occurred");
|
||||
}
|
||||
}
|
||||
return $q.reject(response);
|
||||
});
|
||||
};
|
||||
});
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Configuration for jstd scenario adapter
|
||||
*/
|
||||
var jstdScenarioAdapter = {
|
||||
|
||||
Reference in new issue
Block a user