-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(server): auth dto #5593
Conversation
d3bdb99
to
d6b0c5e
Compare
export class AuthDto { | ||
user!: UserEntity; | ||
|
||
apiKey?: APIKeyEntity; | ||
sharedLink?: SharedLinkEntity; | ||
userToken?: UserTokenEntity; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the bulk of the change, the rest of it is just renaming/updating accessors.
@@ -93,12 +93,12 @@ export class AppGuard implements CanActivate { | |||
const req = context.switchToHttp().getRequest<AuthRequest>(); | |||
|
|||
const authDto = await this.authService.validate(req.headers, req.query as Record<string, string>); | |||
if (authDto.isPublicUser && !isSharedRoute) { | |||
if (authDto.sharedLink && !isSharedRoute) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the alternative mechanism to determine if a user is a public user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auth via a shared link implies the user is a "public user".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1k loc LOL
* refactor: AuthUserDto => AuthDto * refactor: reorganize auth-dto * refactor: AuthUser() => Auth()
Restructure (simplify/standardize) the
AuthDto
, which is used everywhere.