All,
I'm just trying to save a custom object in sessionStorage in an AngularJS application. If I go through this in a Chrome or FF debugger, sessionStorage will never be installed. Here is my angular utility code:
stonewall.authModule = angular.module("authModule", [
"ngStorage"
]);
stonewall.authModule.service('authService', function ($localStorage, $sessionStorage) {
var currentUser = {};
restoreSession();
var storageType = {};
this.getCurrentUser = function () {
return currentUser;
};
this.userAuth = function() {
return currentUser.sid != "";
};
this.logout = function() {
currentUser = {
sid: "",
status: 0,
pswLastSet: 0,
id: "",
sigUID: "",
sig: ""
};
};
this.login = function(user, subj) {
if (user == null) return;
currentUser = {
sid: user.Principal.SId,
status: user.Principal.ControlStatus,
pswLastSet: new Date(user.Principal.PasswordLastSet),
id: user.Identity.Id.DN,
sigUID: user.Identity.Certificates[0].UID,
sig: stonewall.hash(user.Principal.SId + subj.pswd),
};
persistSession();
};
function persistSession() {
$sessionStorage.currentUser = currentUser;
};
function restoreSession() {
currentUser = $sessionStorage.currentUser;
if (currentUser == null) {
currentUser = {
sid: "",
status: 0,
pswLastSet: 0,
id: "",
sigUID: "",
sig: ""
};
}
};
});
And here is a screencast that shows my FF debugging session. You can see that after persistSession is called, $ sessionStorage has my user.

But if I go to the DOM inspector, sessionStorage has no elements in it ...

Any help, as always, is appreciated.
source
share