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) {
184184 configFile = expandUserHomeDir (configFile );
185185 try (BufferedReader br = new BufferedReader (new FileReader (configFile ))) {
186186 JsonConfig cfg = GSON .fromJson (br , JsonConfig .class );
187+ if (cfg == null ) {
188+ throw new RuntimeException ("Empty config" );
189+ }
187190
188191 if (cfg .getTokenEndpoint () != null ) {
189192 builder .withTokenEndpoint (cfg .getTokenEndpoint ());
@@ -312,6 +315,9 @@ private Token updateToken() throws IOException {
312315
313316 try (Reader reader = new InputStreamReader (response .getEntity ().getContent ())) {
314317 OAuth2Response json = GSON .fromJson (reader , OAuth2Response .class );
318+ if (json == null ) {
319+ throw new UnexpectedResultException ("Empty OAuth2 response" , Status .of (StatusCode .INTERNAL_ERROR ));
320+ }
315321
316322 if (!"Bearer" .equalsIgnoreCase (json .getTokenType ())) {
317323 throw new UnexpectedResultException (
You can’t perform that action at this time.
0 commit comments