Skip to content

Commit

Permalink
Fix Sagan authentication.
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaMaciaszek committed Jul 17, 2023
1 parent b993d63 commit 2b66474
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class RestTemplateSaganClientTests {
@BeforeEach
void setup() {
ReleaserProperties properties = new ReleaserProperties();
properties.getGit().setUsername("user");
properties.getGit().setOauthToken("foo");
properties.getSagan().setBaseUrl("http://localhost:23456");
this.client = saganClient(properties);
Expand Down Expand Up @@ -108,7 +109,8 @@ private RestTemplateSaganClient saganClient(ReleaserProperties properties) {
}

private RestTemplate restTemplate(ReleaserProperties properties) {
return new RestTemplateBuilder().basicAuthentication(properties.getGit().getOauthToken(), "").build();
return new RestTemplateBuilder()
.basicAuthentication(properties.getGit().getUsername(), properties.getGit().getOauthToken()).build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ private RestTemplate restTemplate(ReleaserProperties properties) {
"In order to connect to Sagan you need to pass the Github OAuth token. "
+ "You can do it via the [--releaser.git.oauth-token=...] "
+ "command line argument or an env variable [export RELEASER_GIT_OAUTH_TOKEN=...].");
return new RestTemplateBuilder().basicAuthentication(properties.getGit().getOauthToken(), "").build();
return new RestTemplateBuilder()
.basicAuthentication(properties.getGit().getUsername(), properties.getGit().getOauthToken()).build();
}

}

0 comments on commit 2b66474

Please sign in to comment.