Skip to content

Commit

Permalink
throw OAuth2AuthorizationException
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Jul 24, 2023
1 parent 91f1b9d commit a07a7c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
}
],
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable",
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[java]": {
"editor.defaultFormatter": "redhat.java"
}
}
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Create separate E2E test project which locally tests agains running angular + Spring API using Selnium. On CI it uses test containers of both images. Adding authontication headers with own server.
- Try using WebTestClient https://docs.spring.io/spring-framework/reference/testing/webtestclient.html#webtestclient-json
- Add pgAdmin to dev container https://www.pgadmin.org/download/pgadmin-4-container/s
- add p0 deployment as manual action step
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager;
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository;
import org.springframework.security.oauth2.core.OAuth2AccessToken;
import org.springframework.security.oauth2.core.OAuth2AuthorizationException;
import org.springframework.security.oauth2.core.OAuth2Error;
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter;
Expand Down Expand Up @@ -136,7 +138,7 @@ Converter<Map<String, Object>, OAuth2AccessTokenResponse> withingsAccessTokenRes

if (response.getStatus() != 0) {
log.error(response.getError());
throw new WithingsTechnicalException();
throw new OAuth2AuthorizationException(new OAuth2Error("1"), response.getError());
}

WithingsGetAccessTokenResponseBody body = response.getBody();
Expand Down

0 comments on commit a07a7c2

Please sign in to comment.