secure DISABLE_ANONYMOUS
This commit is contained in:
@@ -5,9 +5,7 @@ import { adminApi } from "../Services/AdminApi";
|
||||
import { AuthTokenData, jwtTokenManager } from "../Services/JWTTokenManager";
|
||||
import { parse } from "query-string";
|
||||
import { openIDClient } from "../Services/OpenIDClient";
|
||||
import { DEBUG_IGNORE_SSL, PUSHER_DISABLE_ANONYMOUS } from "../Enum/EnvironmentVariable"
|
||||
import { AxiosRequestConfig } from "axios";
|
||||
import https from "https";
|
||||
import { DISABLE_ANONYMOUS } from "../Enum/EnvironmentVariable"
|
||||
|
||||
export interface TokenInterface {
|
||||
userUuid: string;
|
||||
@@ -173,26 +171,16 @@ export class AuthenticateController extends BaseController {
|
||||
res.end();
|
||||
});
|
||||
|
||||
this.App.post("/anonymLogin", async (res: HttpResponse, req: HttpRequest) => {
|
||||
this.App.post("/anonymLogin", (res: HttpResponse, req: HttpRequest) => {
|
||||
res.onAborted(() => {
|
||||
console.warn("Login request was aborted");
|
||||
});
|
||||
|
||||
if (PUSHER_DISABLE_ANONYMOUS) {
|
||||
if (DISABLE_ANONYMOUS) {
|
||||
res.writeStatus("403 FORBIDDEN");
|
||||
res.end();
|
||||
} else {
|
||||
let userUuid = v4();
|
||||
|
||||
const axiosConfig: AxiosRequestConfig = {};
|
||||
|
||||
if (DEBUG_IGNORE_SSL) {
|
||||
const agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
axiosConfig.httpsAgent = agent;
|
||||
}
|
||||
|
||||
const userUuid = v4();
|
||||
const authToken = jwtTokenManager.createAuthToken(userUuid);
|
||||
res.writeStatus("200 OK");
|
||||
this.addCorsHeaders(res);
|
||||
|
||||
Reference in New Issue
Block a user