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

added max-age #13732

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions ydb/mvp/oidc_proxy/oidc_impersonate_start_page_nebius.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,23 @@ void THandlerImpersonateStart::RequestImpersonatedToken(TString& sessionToken, T
void THandlerImpersonateStart::ProcessImpersonatedToken(const NJson::TJsonValue& jsonValue) {
const NJson::TJsonValue* jsonImpersonatedToken;
const NJson::TJsonValue* jsonExpiresIn;
TString impersonatedToken;
unsigned long long expiresIn;
if (!jsonValue.GetValuePointer("impersonation", &jsonImpersonatedToken)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: impersonation not found");
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: `impersonation` not found");
}
if (!jsonImpersonatedToken->GetString(&impersonatedToken)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: failed to extract `impersonation`");
}
if (!jsonValue.GetValuePointer("expires_in", &jsonExpiresIn)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: expires_in not found");
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: `expires_in` not found");
}
if (!jsonExpiresIn->GetUInteger(&expiresIn)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: failed to extract `expires_in`");
}
if (expiresIn > std::numeric_limits<i32>::max()) {
expiresIn = std::numeric_limits<i32>::max();
StekPerepolnen marked this conversation as resolved.
Show resolved Hide resolved
}
TString impersonatedToken = jsonImpersonatedToken->GetStringRobust();
long long expiresIn = jsonExpiresIn->GetIntegerRobust();
TString impersonatedCookieName = CreateNameImpersonatedCookie(Settings.ClientId);
TString impersonatedCookieValue = Base64Encode(impersonatedToken);
BLOG_D("Set impersonated cookie: (" << impersonatedCookieName << ": " << NKikimr::MaskTicket(impersonatedCookieValue) << ")");
Expand Down
17 changes: 13 additions & 4 deletions ydb/mvp/oidc_proxy/oidc_session_create_nebius.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,23 @@ void THandlerSessionCreateNebius::RequestSessionToken(const TString& code) {
void THandlerSessionCreateNebius::ProcessSessionToken(const NJson::TJsonValue& jsonValue) {
const NJson::TJsonValue* jsonAccessToken;
const NJson::TJsonValue* jsonExpiresIn;
TString sessionToken;
unsigned long long expiresIn;
if (!jsonValue.GetValuePointer("access_token", &jsonAccessToken)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: access_token not found");
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: `access_token` not found");
}
if (!jsonAccessToken->GetString(&sessionToken)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: failed to extract `access_token`");
}
if (!jsonValue.GetValuePointer("expires_in", &jsonExpiresIn)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: expires_in not found");
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: `expires_in` not found");
}
if (!jsonExpiresIn->GetUInteger(&expiresIn)) {
return ReplyBadRequestAndPassAway("Wrong OIDC provider response: failed to extract `expires_in`");
}
if (expiresIn > std::numeric_limits<i32>::max()) {
expiresIn = std::numeric_limits<i32>::max();
}
TString sessionToken = jsonAccessToken->GetStringRobust();
long long expiresIn = jsonExpiresIn->GetIntegerRobust();
TString sessionCookieName = CreateNameSessionCookie(Settings.ClientId);
TString sessionCookieValue = Base64Encode(sessionToken);
BLOG_D("Set session cookie: (" << sessionCookieName << ": " << NKikimr::MaskTicket(sessionCookieValue) << ")");
Expand Down
2 changes: 1 addition & 1 deletion ydb/mvp/oidc_proxy/oidc_session_create_yandex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void THandlerSessionCreateYandex::ProcessSessionToken(const NJson::TJsonValue& j
SetHeader(meta, "authorization", token);
meta.Timeout = TDuration::Seconds(10);

NActors::TActorSystem* actorSystem = TlsActivationContext->ActorSystem();
NActors::TActorSystem* actorSystem = TActivationContext::ActorSystem();
NActors::TActorId actorId = SelfId();
NYdbGrpc::TResponseCallback<yandex::cloud::priv::oauth::v1::CreateSessionResponse> responseCb =
[actorId, actorSystem](NYdbGrpc::TGrpcStatus&& status, yandex::cloud::priv::oauth::v1::CreateSessionResponse&& response) -> void {
Expand Down
Loading