File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 5
5
HeadersObject ,
6
6
properties ,
7
7
signToBase64 ,
8
+ Store ,
8
9
} from './index.js' ;
9
10
10
11
/** Returns a JSON-AD resource of an Authentication */
@@ -96,8 +97,9 @@ const setCookieExpires = (
96
97
97
98
/** Sets a cookie for the current Agent, signing the Authentication. It expires after some default time. */
98
99
export const setCookieAuthentication = ( store : Store , agent : Agent ) => {
99
- createAuthentication ( store . getServerUrl ( ) , agent ) . then ( auth => {
100
- setCookieExpires ( COOKIE_NAME_AUTH , btoa ( JSON . stringify ( auth ) ) , store ) ;
100
+ const serverURL = store . getServerUrl ( ) ;
101
+ createAuthentication ( serverURL , agent ) . then ( auth => {
102
+ setCookieExpires ( COOKIE_NAME_AUTH , btoa ( JSON . stringify ( auth ) ) , serverURL ) ;
101
103
} ) ;
102
104
} ;
103
105
Original file line number Diff line number Diff line change 1
- import { setCookieAuthentication } from './authentication.js' ;
1
+ import {
2
+ removeCookieAuthentication ,
3
+ setCookieAuthentication ,
4
+ } from './authentication.js' ;
2
5
import { EventManager } from './EventManager.js' ;
3
6
import {
4
7
Agent ,
@@ -488,6 +491,8 @@ export class Store {
488
491
this . fetchResourceFromServer ( r . getSubject ( ) ) ;
489
492
}
490
493
} ) ;
494
+ } else {
495
+ removeCookieAuthentication ( ) ;
491
496
}
492
497
493
498
this . eventManager . emit ( StoreEvents . AgentChanged , agent ) ;
You can’t perform that action at this time.
0 commit comments