Skip to content

Commit 15ab63b

Browse files
committed
endpoint for OAuth2Providers
1 parent 964f763 commit 15ab63b

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

server/src/main/java/dev/findfirst/users/controller/UserController.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ public ResponseEntity<List<Oauth2Source>> oauth2Providers() {
105105
// do we really want to trust anything that isn't https?
106106
return;
107107
}
108-
var domain = noProto.indexOf("/");
109-
var faviconURI = "https://" + noProto.substring(0, domain) + "/favicon.ico";
110-
108+
var favDomain = noProto.indexOf("/");
109+
var faviconURI = "https://" + noProto.substring(0, favDomain) + "/favicon.ico";
110+
var registrationId = provider.getRegistrationId();
111111
log.debug("Favicon URI {}", faviconURI);
112-
listOfAuth2Providers.add(new Oauth2Source(provider.getClientName(), faviconURI));
112+
listOfAuth2Providers.add(new Oauth2Source(provider.getClientName(), faviconURI,
113+
"oauth2/authorization/" + registrationId));
113114
});
114115
return ResponseEntity.ofNullable(listOfAuth2Providers);
115116
}
@@ -215,7 +216,8 @@ public ResponseEntity<String> refreshToken(
215216
public ResponseEntity<String> uploadProfilePicture(
216217
@Valid @RequestParam("file") @FileSize MultipartFile file) throws NoUserFoundException {
217218
log.debug("Attempting to add user profile picture");
218-
User user = userService.getUserById(uContext.getUserId()).orElseThrow(NoUserFoundException::new);
219+
User user =
220+
userService.getUserById(uContext.getUserId()).orElseThrow(NoUserFoundException::new);
219221

220222
// File type validation
221223
String contentType = file.getContentType();

0 commit comments

Comments
 (0)