Skip to content

Commit 4740b10

Browse files
authored
Merge pull request #117 from cyberark/no-host-login
Avoid calling login for host
2 parents 01ddd0f + 1f0427d commit 4740b10

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Avoid calling `login` for host
10+
[cyberark/conjur-api-java#117](https://github.com/cyberark/conjur-api-java/pull/117)
811

912
## [3.0.4] - 2023-02-27
1013

src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ public AuthnClient(final Credentials credentials,
4545

4646
// replacing the password with an API key
4747
this.apiKey = credentials.getPassword();
48-
if(credentials.getAuthnUrl().endsWith("/authn")){
48+
// login() exchanges a user's password for an API key. This is not relevant for hosts since they
49+
// don't have passwords (only API keys). It's also only relevant for standard API key authentication
50+
// (authn), not other authentication methods.
51+
if(credentials.getAuthnUrl().endsWith("/authn") && !credentials.getUsername().startsWith("host/")){
4952
this.apiKey = login();
5053
}
5154
}

0 commit comments

Comments
 (0)