-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanere utgående STS, standardisere proxy, maskinporten (#1378)
* Sanere utgående STS, standardisere proxy, maskinporten * Justere levetid assertions og cache-evict
- Loading branch information
Showing
21 changed files
with
393 additions
and
274 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
47 changes: 47 additions & 0 deletions
47
felles/klient/src/main/java/no/nav/vedtak/klient/http/ProxyProperty.java
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package no.nav.vedtak.klient.http; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.net.ProxySelector; | ||
import java.net.URI; | ||
import java.net.http.HttpClient; | ||
import java.util.Optional; | ||
|
||
import no.nav.foreldrepenger.konfig.Environment; | ||
|
||
/** | ||
* Standard navn på environment injisert av NAIS når maskinporten er enabled | ||
* Dvs naiserator:spec:maskinporten:enabled: true | ||
*/ | ||
public class ProxyProperty { | ||
private static final Environment ENV = Environment.current(); | ||
|
||
private static final String AZURE_HTTP_PROXY = "azure.http.proxy"; | ||
private static final String DEFAULT_PROXY_URL = "http://webproxy.nais:8088"; | ||
|
||
private ProxyProperty() { | ||
} | ||
|
||
public static URI getProxy() { | ||
return URI.create(ENV.getProperty(AZURE_HTTP_PROXY, DEFAULT_PROXY_URL)); | ||
} | ||
|
||
public static URI getProxyIfFSS() { | ||
return ENV.isFss() ? getProxy() : null; | ||
} | ||
|
||
public static ProxySelector getProxySelector() { | ||
var proxy = getProxy(); | ||
return ProxySelector.of(new InetSocketAddress(proxy.getHost(), proxy.getPort())); | ||
} | ||
|
||
public static ProxySelector getProxySelectorIfFSS() { | ||
return ENV.isFss() ? getProxySelector() : HttpClient.Builder.NO_PROXY; | ||
} | ||
|
||
public static ProxySelector getProxySelector(URI proxy) { | ||
return Optional.ofNullable(proxy) | ||
.map(p -> new InetSocketAddress(p.getHost(), p.getPort())) | ||
.map(ProxySelector::of) | ||
.orElse(HttpClient.Builder.NO_PROXY); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/MaskinportenProperty.java
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package no.nav.vedtak.sikkerhet.oidc.config; | ||
|
||
/** | ||
* Standard navn på environment injisert av NAIS når maskinporten er enabled | ||
* Dvs naiserator:spec:maskinporten:enabled: true | ||
*/ | ||
public enum MaskinportenProperty { | ||
MASKINPORTEN_CLIENT_ID, | ||
MASKINPORTEN_CLIENT_JWK, | ||
MASKINPORTEN_SCOPES, // Må angis i naiserator:spec:maskinporten:scopes:consumes: (-name: "<scope>") | ||
MASKINPORTEN_WELL_KNOWN_URL, // Sanere bruk av well known - bruk heller NAIS/env | ||
MASKINPORTEN_ISSUER, | ||
MASKINPORTEN_TOKEN_ENDPOINT | ||
|
||
} |
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
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
Oops, something went wrong.