File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
auth-providers/oauth2-provider/src/main/java/tech/ydb/auth Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,9 @@ public static Builder fromFile(File configFile) {
184
184
configFile = expandUserHomeDir (configFile );
185
185
try (BufferedReader br = new BufferedReader (new FileReader (configFile ))) {
186
186
JsonConfig cfg = GSON .fromJson (br , JsonConfig .class );
187
+ if (cfg == null ) {
188
+ throw new RuntimeException ("Empty config" );
189
+ }
187
190
188
191
if (cfg .getTokenEndpoint () != null ) {
189
192
builder .withTokenEndpoint (cfg .getTokenEndpoint ());
@@ -312,6 +315,9 @@ private Token updateToken() throws IOException {
312
315
313
316
try (Reader reader = new InputStreamReader (response .getEntity ().getContent ())) {
314
317
OAuth2Response json = GSON .fromJson (reader , OAuth2Response .class );
318
+ if (json == null ) {
319
+ throw new UnexpectedResultException ("Empty OAuth2 response" , Status .of (StatusCode .INTERNAL_ERROR ));
320
+ }
315
321
316
322
if (!"Bearer" .equalsIgnoreCase (json .getTokenType ())) {
317
323
throw new UnexpectedResultException (
You can’t perform that action at this time.
0 commit comments