🔐 Initial change on the public links using anonymous users (#69)
* Initial change on the public links using anonymous users Co-authored-by: Anton Shepilov <anton.shepilov@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@ export default interface AuthServiceAPI extends TdriveServiceProvider {
|
||||
track: boolean;
|
||||
provider_id: string;
|
||||
application_id?: string;
|
||||
public_token_document_id?: string;
|
||||
} & any,
|
||||
): AccessToken;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,12 @@ export class AuthService implements AuthServiceAPI {
|
||||
generateJWT(
|
||||
userId: uuid,
|
||||
email: string,
|
||||
options: { track: boolean; provider_id: string; application_id?: string },
|
||||
options: {
|
||||
track: boolean;
|
||||
provider_id: string;
|
||||
application_id?: string;
|
||||
public_token_document_id?: string;
|
||||
},
|
||||
): AccessToken {
|
||||
const now = Math.round(new Date().getTime() / 1000); // Current time in UTC
|
||||
assert(this.configuration.expiration, "jwt.expiration is missing");
|
||||
@@ -53,6 +58,7 @@ export class AuthService implements AuthServiceAPI {
|
||||
track: !!options.track,
|
||||
provider_id: options.provider_id || "",
|
||||
application_id: options.application_id,
|
||||
public_token_document_id: options.public_token_document_id,
|
||||
} as JwtType),
|
||||
refresh: this.sign({
|
||||
exp: jwtRefreshExpiration,
|
||||
@@ -64,6 +70,7 @@ export class AuthService implements AuthServiceAPI {
|
||||
track: !!options.track,
|
||||
provider_id: options.provider_id || "",
|
||||
application_id: options.application_id,
|
||||
public_token_document_id: options.public_token_document_id,
|
||||
} as JwtType),
|
||||
type: "Bearer",
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ const jwtPlugin: FastifyPluginCallback = (fastify, _opts, next) => {
|
||||
...{ application_id: jwt.application_id || null },
|
||||
...{ server_request: jwt.server_request || false },
|
||||
...{ allow_tracking: jwt.track || false },
|
||||
...{ public_token_document_id: jwt.public_token_document_id || null },
|
||||
};
|
||||
request.log.debug(`Authenticated as user ${request.currentUser.id}`);
|
||||
};
|
||||
|
||||
@@ -125,7 +125,7 @@ export default class EmailPusherClass
|
||||
this.logger.info("email sent");
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error("Failed to send email", error);
|
||||
this.logger.error({ error: `${error}` }, "Failed to send email");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { TransportRequestOptions } from "@elastic/elasticsearch/lib/Transport";
|
||||
import { logger } from "../../../../../../core/platform/framework/logger";
|
||||
import { EntityTarget, FindFilter, FindOptions, getEntityDefinition } from "../../api";
|
||||
import { asciiFold } from "../utils";
|
||||
import { comparisonType } from "src/core/platform/services/database/services/orm/repository/repository";
|
||||
import { comparisonType } from "../../../../../../core/platform/services/database/services/orm/repository/repository";
|
||||
|
||||
export function buildSearchQuery<Entity>(
|
||||
entityType: EntityTarget<Entity>,
|
||||
|
||||
@@ -9,4 +9,5 @@ export type JwtType = {
|
||||
refresh_nbf?: number;
|
||||
iat: number;
|
||||
track: boolean;
|
||||
public_token_document_id?: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user