Skip to content
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

Merged
merged 3 commits into from
Dec 10, 2023
Merged

refactor(server): auth dto #5593

merged 3 commits into from
Dec 10, 2023

Conversation

jrasm91
Copy link
Contributor

@jrasm91 jrasm91 commented Dec 10, 2023

Restructure (simplify/standardize) the AuthDto, which is used everywhere.

Comment on lines +6 to 12
export class AuthDto {
user!: UserEntity;

apiKey?: APIKeyEntity;
sharedLink?: SharedLinkEntity;
userToken?: UserTokenEntity;
}
Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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".

@jrasm91 jrasm91 merged commit 33529d1 into main Dec 10, 2023
18 checks passed
@jrasm91 jrasm91 deleted the refactor/auth-dto branch December 10, 2023 04:34
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1k loc LOL

jonhnet pushed a commit to jonhnet/immich that referenced this pull request Dec 15, 2023
* refactor: AuthUserDto => AuthDto

* refactor: reorganize auth-dto

* refactor: AuthUser() => Auth()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants