Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -470,16 +470,14 @@ public Authentication authenticate(Authentication authentication) throws Authent
if (authentication instanceof GitLabAuthenticationToken) {
return authentication;
}
if (authentication instanceof UsernamePasswordAuthenticationToken) {
if (authentication instanceof UsernamePasswordAuthenticationToken token) {
try {
UsernamePasswordAuthenticationToken token =
(UsernamePasswordAuthenticationToken) authentication;
GitLabAuthenticationToken gitlab = new GitLabAuthenticationToken(
token.getCredentials().toString(), getGitlabApiUri(), TokenType.PRIVATE);
SecurityContextHolder.getContext().setAuthentication(gitlab);
return gitlab;
} catch (GitLabApiException e) {
throw new RuntimeException(e);
throw new BadCredentialsException("Authentication failed", e);
}
}
throw new BadCredentialsException("Unexpected authentication type: " + authentication);
Expand Down
Loading