mirror of
https://github.com/immich-app/immich.git
synced 2026-05-22 15:42:32 -04:00
feat(server): added backchannel logout api endpoint (#26235)
* feat(server): added backchannel logout api endpoint * test(server): fixed e2e tests * fix(server): fixed suggested changes by reviewer * feat(server): created function invalidateOAuth * fix(server): fixed session.repository.sql * test(server): added unit tests for backchannelLogout function * test(server): added e2e tests for oidc backchnnel logout * docs(server): added documentation on backchannel logout url * docs(server): fixed typo * feat(server): minor improvements of the oidc backchannel logout * test(server): fixed tests after merge with main * fix(server): fixed e2e test file * refactor(server): tiny refactor of validateLogoutToken * chore: cleanup * fix: tests * fix: make jwks extractable --------- Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Body, Controller, Get, HttpCode, HttpStatus, Post, Redirect, Req, Res } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { ApiConsumes, ApiTags } from '@nestjs/swagger';
|
||||
import { Request, Response } from 'express';
|
||||
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
||||
import {
|
||||
AuthDto,
|
||||
LoginResponseDto,
|
||||
OAuthAuthorizeResponseDto,
|
||||
OAuthBackchannelLogoutDto,
|
||||
OAuthCallbackDto,
|
||||
OAuthConfigDto,
|
||||
} from 'src/dtos/auth.dto';
|
||||
@@ -112,4 +113,17 @@ export class OAuthController {
|
||||
unlinkOAuthAccount(@Auth() auth: AuthDto): Promise<UserAdminResponseDto> {
|
||||
return this.service.unlink(auth);
|
||||
}
|
||||
|
||||
@Post('backchannel-logout')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiConsumes('application/x-www-form-urlencoded')
|
||||
@Endpoint({
|
||||
summary: 'Backchannel OAuth logout',
|
||||
description:
|
||||
'Logout the OAuth account and invalidate the session specified by the sid claim or all sessions if the sid claim is not present.',
|
||||
history: new HistoryBuilder().added('v2'),
|
||||
})
|
||||
async logoutOAuth(@Body() dto: OAuthBackchannelLogoutDto): Promise<void> {
|
||||
return this.service.backchannelLogout(dto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user