Skip to content

Commit f5dae2a

Browse files
OIDC changed token request authorization (#14587)
1 parent a76b6a1 commit f5dae2a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ydb/mvp/oidc_proxy/oidc_session_create_nebius.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <ydb/library/actors/http/http.h>
22
#include <ydb/library/security/util.h>
3+
#include <ydb/mvp/core/mvp_tokens.h>
34
#include "openid_connect.h"
45
#include "oidc_session_create_nebius.h"
56
#include <library/cpp/string_utils/base64/base64.h>
@@ -19,14 +20,21 @@ void THandlerSessionCreateNebius::RequestSessionToken(const TString& code) {
1920
TCgiParameters params;
2021
params.emplace("code", code);
2122
params.emplace("client_id", code);
23+
params.emplace("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:access_token_bearer");
2224
params.emplace("grant_type", "authorization_code");
2325
params.emplace("redirect_uri", TStringBuilder() << (Request->Endpoint->Secure ? "https://" : "http://")
2426
<< host
2527
<< GetAuthCallbackUrl());
2628

2729
NHttp::THttpOutgoingRequestPtr httpRequest = NHttp::THttpOutgoingRequest::CreateRequestPost(Settings.GetTokenEndpointURL());
2830
httpRequest->Set<&NHttp::THttpRequest::ContentType>("application/x-www-form-urlencoded");
29-
httpRequest->Set("Authorization", Settings.GetAuthorizationString());
31+
32+
TMvpTokenator* tokenator = MVPAppData()->Tokenator;
33+
TString token = "";
34+
if (tokenator) {
35+
token = tokenator->GetToken(Settings.SessionServiceTokenName);
36+
}
37+
httpRequest->Set("Authorization", token); // Bearer included
3038
httpRequest->Set<&NHttp::THttpRequest::Body>(params());
3139

3240
Send(HttpProxyId, new NHttp::TEvHttpProxy::TEvHttpOutgoingRequest(httpRequest));

0 commit comments

Comments
 (0)