-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,58 @@ | ||
package com.google.auth.oauth2; | ||
|
||
import com.google.errorprone.annotations.CanIgnoreReturnValue; | ||
|
||
/** Holds an mTLS configuration (consists of address of S2A) retrieved from the Metadata Server. */ | ||
public final class MtlsConfig { | ||
private final String s2aAddress; | ||
// plaintextS2AAddress is the plaintext address to reach the S2A. | ||
private final String plaintextS2AAddress; | ||
|
||
// mtlsS2AAddress is the mTLS address to reach the S2A. | ||
private final String mtlsS2AAddress; | ||
|
||
public static Builder createBuilder() { | ||
return new Builder(); | ||
} | ||
|
||
public String getPlaintextS2AAddress() { | ||
return plaintextS2AAddress; | ||
} | ||
|
||
public static MtlsConfig createMtlsConfig(String addr) { | ||
return new MtlsConfig(addr); | ||
public String getMtlsS2AAddress() { | ||
return mtlsS2AAddress; | ||
} | ||
|
||
public String getS2AAddress() { | ||
return s2aAddress; | ||
public static final class Builder { | ||
// plaintextS2AAddress is the plaintext address to reach the S2A. | ||
private String plaintextS2AAddress; | ||
|
||
// mtlsS2AAddress is the mTLS address to reach the S2A. | ||
private String mtlsS2AAddress; | ||
|
||
Builder() { | ||
plaintextS2AAddress = ""; | ||
mtlsS2AAddress = ""; | ||
} | ||
|
||
@CanIgnoreReturnValue | ||
public Builder setPlaintextS2AAddress(String plaintextS2AAddress) { | ||
this.plaintextS2AAddress = plaintextS2AAddress; | ||
return this; | ||
} | ||
|
||
@CanIgnoreReturnValue | ||
public Builder setMtlsS2AAddress(String mtlsS2AAddress) { | ||
this.mtlsS2AAddress = mtlsS2AAddress; | ||
return this; | ||
} | ||
|
||
public MtlsConfig build() { | ||
return new MtlsConfig(plaintextS2AAddress, mtlsS2AAddress); | ||
} | ||
} | ||
|
||
private MtlsConfig(String addr) { | ||
this.s2aAddress = addr; | ||
private MtlsConfig(String plaintextS2AAddress, String mtlsS2AAddress) { | ||
this.plaintextS2AAddress = plaintextS2AAddress; | ||
this.mtlsS2AAddress = mtlsS2AAddress; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters