<commit_before>angular.module('configuration.identity', ['configuration.rest', 'ngCookies', 'ui.router'])

    .controller('identityController', function($scope, identityService, authenticationService, $resource, restConfigService) {

        $scope.identity = identityService.getIdentity();

        $scope.$on('auth.login', function() {
            $scope.identity = identityService.getIdentity();
        });

        $scope.signOut = function () {            
            delete $scope.identity;
            authenticationService.signOut();
            identityService.clear();
        };
    })

    .service('identityService', function($q, $http, $resource, $cookies, $log, restConfigService) {

        var identity;
        var Identity = $resource(restConfigService.getIdentityOperation());
        var cookieTimeOutMinutes = 120;
        var cookieTimeOutMillis = new Date(new Date().getTime() + cookieTimeOutMinutes * 60 * 1000);

        return {

            getIdentity: function () {
                if (identity) {
                    return identity;
                }

                if($cookies.get("username") && $cookies.get("authorities")) {
                    identity = {username: $cookies.get("username"), authorities: $cookies.get("authorities").split(",")};
                    return identity;
                }
                return null;
            },

            update: function (newIdentity) {
                identity = newIdentity;
                $cookies.put("username" , identity.username, {expires: new Date(2016, 1, 1)});
                $cookies.put("authorities" , identity.authorities.join(), {expires: cookieTimeOutMillis });
            },

            clear: function() {
                identity = null;
                $cookies.remove("username");
                $cookies.remove("authorities");
            }
        };
    });<commit_msg>Removed the hardcoded expiry<commit_after>angular.module('configuration.identity', ['configuration.rest', 'ngCookies', 'ui.router'])

    .controller('identityController', function($scope, identityService, authenticationService, $resource, restConfigService) {

        $scope.identity = identityService.getIdentity();

        $scope.$on('auth.login', function() {
            $scope.identity = identityService.getIdentity();
        });

        $scope.signOut = function () {
            delete $scope.identity;
            authenticationService.signOut();
            identityService.clear();
        };
    })

    .service('identityService', function($q, $http, $resource, $cookies, $log, restConfigService) {

        var identity;
        var Identity = $resource(restConfigService.getIdentityOperation());
        var cookieTimeOutMinutes = 120;
        var cookieTimeOutMillis = new Date(new Date().getTime() + cookieTimeOutMinutes * 60 * 1000);

        return {

            getIdentity: function () {
                if (identity) {
                    return identity;
                }

                if($cookies.get("username") && $cookies.get("authorities")) {
                    identity = {username: $cookies.get("username"), authorities: $cookies.get("authorities").split(",")};
                    return identity;
                }
                return null;
            },

            update: function (newIdentity) {
                identity = newIdentity;
                $cookies.put("username" , identity.username, {expires: cookieTimeOutMillis });
                $cookies.put("authorities" , identity.authorities.join(), {expires: cookieTimeOutMillis });
            },

            clear: function() {
                identity = null;
                $cookies.remove("username");
                $cookies.remove("authorities");
            }
        };
    });
{'fraction_non_alphanumeric': 0.13090525204539458, 'fraction_numerical': 0.006334125098970704, 'mean_word_length': 2.007936507936508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2499764', 'n_tokens_mistral': 970, 'n_tokens_neox': 901, 'n_words': 170}