add versioning and storage
This commit is contained in:
		
							parent
							
								
									7344c85454
								
							
						
					
					
						commit
						b4b4aeab04
					
				
							
								
								
									
										19
									
								
								js/issuer.js
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								js/issuer.js
									
									
									
									
									
								
							@ -1,6 +1,11 @@
 | 
			
		||||
$(function () {
 | 
			
		||||
  'use strict';
 | 
			
		||||
 | 
			
		||||
  if ('1' !== window.localStorage.getItem('version')) {
 | 
			
		||||
    window.localStorage.clear();
 | 
			
		||||
    window.localStorage.setItem('version', '1');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  var OAUTH3 = window.OAUTH3;
 | 
			
		||||
  var CONFIG = {
 | 
			
		||||
    host: OAUTH3.utils.clientUri(window.location)
 | 
			
		||||
@ -14,6 +19,20 @@ $(function () {
 | 
			
		||||
  };
 | 
			
		||||
  $('.js-scopes-container').html('');
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
  OAUTH3._hooks.sessions.all = function (providerUri) {
 | 
			
		||||
  };
 | 
			
		||||
  */
 | 
			
		||||
  OAUTH3._hooks = { sessions: {} };
 | 
			
		||||
  OAUTH3._hooks.sessions.get = function (providerUri, id) {
 | 
			
		||||
    return JSON.parse(window.localStorage.getItem('session-' + providerUri + (id || '')) || 'null');
 | 
			
		||||
  };
 | 
			
		||||
  OAUTH3._hooks.sessions.set = function (providerUri, newSession, id) {
 | 
			
		||||
    window.localStorage.setItem('session-' + providerUri, JSON.stringify(newSession));
 | 
			
		||||
    window.localStorage.setItem('session-' + providerUri + (id || newSession.id || newSession.token.id || ''), JSON.stringify(newSession));
 | 
			
		||||
    return newSession;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  // TODO let query.parse do location.hash || location.search || location
 | 
			
		||||
  var clientParams = OAUTH3.query.parse(window.location.hash || window.location.search);
 | 
			
		||||
  if (/authorization_dialog/.test(window.location.href)) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user