-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34dcd14
commit c348947
Showing
15 changed files
with
497 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,43 @@ | ||
#include <library/cpp/json/json_reader.h> | ||
#include <library/cpp/string_utils/base64/base64.h> | ||
#include <ydb/library/actors/http/http.h> | ||
#include <ydb/mvp/core/mvp_log.h> | ||
#include "openid_connect.h" | ||
#include "oidc_session_create.h" | ||
#include "oidc_settings.h" | ||
#include "oidc_impersonate_stop_page_nebius.h" | ||
|
||
namespace NMVP { | ||
namespace NOIDC { | ||
|
||
THandlerImpersonateStop::THandlerSessionCreate(const NActors::TActorId& sender, | ||
const NHttp::THttpIncomingRequestPtr& request, | ||
const NActors::TActorId& httpProxyId, | ||
const TOpenIdConnectSettings& settings) | ||
THandlerImpersonateStop::THandlerImpersonateStop(const NActors::TActorId& sender, | ||
const NHttp::THttpIncomingRequestPtr& request, | ||
const NActors::TActorId& httpProxyId, | ||
const TOpenIdConnectSettings& settings) | ||
: Sender(sender) | ||
, Request(request) | ||
, HttpProxyId(httpProxyId) | ||
, Settings(settings) | ||
{} | ||
|
||
void THandlerImpersonateStop::Bootstrap(const NActors::TActorContext& ctx) { | ||
NHttp::THeadersBuilder responseHeaders;responseHeaders | ||
TString impersonatedCookieName = CreateNameImpersonatedCookie(Settings.ClientId); | ||
LOG_DEBUG_S(ctx, EService::MVP, "Clear impersonated cookie: (" << impersonatedCookieName << ")"); | ||
|
||
NHttp::THeadersBuilder responseHeaders; | ||
responseHeaders.Set("Set-Cookie", ClearSecureCookie(impersonatedCookieName)); | ||
SetCORS(Request, &responseHeaders); | ||
responseHeaders.Set("Set-Cookie", CreateSecureCookie(Settings.ClientId, sessionToken)); | ||
|
||
NHttp::THttpOutgoingResponsePtr httpResponse; | ||
httpResponse = Request->CreateResponse("200", "OK", responseHeaders); | ||
ctx.Send(Sender, new NHttp::TEvHttpProxy::TEvHttpOutgoingResponse(httpResponse)); | ||
Die(ctx); | ||
} | ||
|
||
TImpersonateStopPageHandler::TImpersonateStopPageHandler(const NActors::TActorId& httpProxyId, const TOpenIdConnectSettings& settings) | ||
: TBase(&TImpersonateStopPageHandler::StateWork) | ||
, HttpProxyId(httpProxyId) | ||
, Settings(settings) | ||
{} | ||
|
||
void TImpersonateStopPageHandler::Handle(NHttp::TEvHttpProxy::TEvHttpIncomingRequest::TPtr event, const NActors::TActorContext& ctx) { | ||
ctx.Register(new THandlerImpersonateStop(event->Sender, event->Get()->Request, HttpProxyId, Settings)); | ||
} | ||
|
||
} // NOIDC | ||
} // NMVP |
Oops, something went wrong.