Skip to content

Commit c96406f

Browse files
Merge add8c90 into 3505562
2 parents 3505562 + add8c90 commit c96406f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

ydb/mvp/oidc_proxy/oidc_session_create.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ class THandlerSessionCreate : public NActors::TActorBootstrapped<THandlerSession
151151
httpRequest->Set<&NHttp::THttpRequest::Body>(body);
152152
ctx.Send(HttpProxyId, new NHttp::TEvHttpProxy::TEvHttpOutgoingRequest(httpRequest));
153153
} else {
154-
ResponseHeaders.Set("Content-Type", "text/plain");
155-
NHttp::THttpOutgoingResponsePtr response = Request->CreateResponse("400", "Bad Request", ResponseHeaders, "Parameters state and code are invalid");
154+
NHttp::THttpOutgoingResponsePtr response = GetHttpOutgoingResponsePtr(TStringBuf(), Request, Settings, ResponseHeaders, IsAjaxRequest);
156155
ctx.Send(Sender, new NHttp::TEvHttpProxy::TEvHttpOutgoingResponse(response));
157156
TBase::Die(ctx);
158157
return;

ydb/mvp/oidc_proxy/openid_connect.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ TString CreateRedirectUrl(const TRedirectUrlParameters& parameters) {
3030
TStringBuilder locationHeaderValue;
3131
TStringBuf authUrl = "/oauth/authorize";
3232
const auto& eventDetails = parameters.SessionServerCheckDetails;
33-
size_t posAuthUrl = eventDetails.find(authUrl);
34-
if (posAuthUrl != TStringBuf::npos) {
35-
size_t pos = eventDetails.rfind("https://", posAuthUrl);
36-
locationHeaderValue << eventDetails.substr(pos, posAuthUrl - pos);
33+
if (eventDetails) {
34+
size_t posAuthUrl = eventDetails.find(authUrl);
35+
if (posAuthUrl != TStringBuf::npos) {
36+
size_t pos = eventDetails.rfind("https://", posAuthUrl);
37+
locationHeaderValue << eventDetails.substr(pos, posAuthUrl - pos);
38+
} else {
39+
locationHeaderValue << parameters.OidcSettings.AuthorizationServerAddress;
40+
}
3741
} else {
3842
locationHeaderValue << parameters.OidcSettings.AuthorizationServerAddress;
3943
}

0 commit comments

Comments
 (0)