satellite/console: remove domain prefix from token cookie key (#3170)
This commit is contained in:
parent
c9e0aa7c70
commit
f05a2eea5b
@ -198,14 +198,7 @@ func (server *Server) bucketUsageReportHandler(w http.ResponseWriter, r *http.Re
|
||||
var err error
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
host, _, err := net.SplitHostPort(r.Host)
|
||||
if err != nil {
|
||||
server.log.Error("bucket usage report error", zap.Error(err))
|
||||
server.serveError(w, r, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
tokenCookie, err := r.Cookie(host + "_tokenKey")
|
||||
tokenCookie, err := r.Cookie("_tokenKey")
|
||||
if err != nil {
|
||||
server.serveError(w, r, http.StatusUnauthorized)
|
||||
return
|
||||
|
@ -3,13 +3,8 @@
|
||||
|
||||
// AuthToken exposes methods to manage auth cookie
|
||||
export class AuthToken {
|
||||
private static readonly tokenKeySuffix: string = '_tokenKey';
|
||||
private static tokenKey: string = '_tokenKey';
|
||||
|
||||
public static initialize(): void {
|
||||
AuthToken.tokenKey = (document as any).location.hostname + AuthToken.tokenKeySuffix;
|
||||
}
|
||||
|
||||
public static get(): string {
|
||||
return AuthToken.getCookie(AuthToken.tokenKey);
|
||||
}
|
||||
@ -42,5 +37,3 @@ export class AuthToken {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
AuthToken.initialize();
|
||||
|
Loading…
Reference in New Issue
Block a user