authentication-server-side.js revision 4701cb94cccc5ef52c5333593fe9dd5a2376a9d9
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Joostelogger.message("Starting authentication javascript");
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Jooste// Log out current cookies in the request
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Jooste // Fetch user information via REST
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Jooste var response = httpClient.get("http://localhost:8080/openam/json/users/" + username, {
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Jooste // Log out response from REST call
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Jooste logger.message("User REST Call. Status: " + response.getStatusCode() + ", Body: " + response.getEntity());
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Joostevar now = new Date();
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Joostelogger.message("Current time: " + now.getHours());
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Joosteif (now.getHours() < START_TIME || now.getHours() > END_TIME) {
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Jooste logger.error("Login forbidden outside work hours!");