satellite/console: remove domain prefix from token cookie key (#3170)

This commit is contained in:
Yaroslav Vorobiov 2019-10-04 01:23:52 -06:00 committed by Egon Elbre
parent c9e0aa7c70
commit f05a2eea5b
2 changed files with 1 additions and 15 deletions

View File

@ -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

View File

@ -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();