File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -160,14 +160,21 @@ bool RestHandler::forwardRequest() {
160
160
}
161
161
auto auth = AuthenticationFeature::instance ();
162
162
if (auth != nullptr && auth->isActive()) {
163
- VPackBuilder builder;
164
- {
165
- VPackObjectBuilder payload{&builder};
166
- payload->add (" preferred_username" , VPackValue (_request->user ()));
163
+
164
+ // when in superuser mode, username is empty
165
+ // in this case ClusterComm will add the default superuser token
166
+ std::string const & username = _request->user ();
167
+ if (!username.empty ()) {
168
+
169
+ VPackBuilder builder;
170
+ {
171
+ VPackObjectBuilder payload{&builder};
172
+ payload->add (" preferred_username" , VPackValue (username));
173
+ }
174
+ VPackSlice slice = builder.slice ();
175
+ headers.emplace (StaticStrings::Authorization,
176
+ " bearer " + auth->tokenCache ()->generateJwt (slice));
167
177
}
168
- VPackSlice slice = builder.slice ();
169
- headers.emplace (StaticStrings::Authorization,
170
- " bearer " + auth->tokenCache ()->generateJwt (slice));
171
178
}
172
179
173
180
auto & values = _request->values ();
You can’t perform that action at this time.
0 commit comments