-
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.
change/clientcredential_factory (#3695)
Lagt til ClientCredentialAutoConfiguration og TokenServiceAutoConfiguration for lettere håndtering av config fra NAIS.
- Loading branch information
Showing
64 changed files
with
561 additions
and
261 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
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
31 changes: 9 additions & 22 deletions
31
.../no/nav/testnav/libs/reactivesecurity/config/SecureOAuth2ServerToServerConfiguration.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
26 changes: 0 additions & 26 deletions
26
...tive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/domain/AccessScopes.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
.../main/java/no/nav/testnav/libs/reactivesecurity/domain/AzureNavProxyClientCredential.java
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
...n/java/no/nav/testnav/libs/reactivesecurity/domain/AzureTrygdeetatenClientCredential.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...eactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/domain/Scopeable.java
This file was deleted.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
...ain/java/no/nav/testnav/libs/reactivesecurity/exchange/TokenServiceAutoConfiguration.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,86 @@ | ||
package no.nav.testnav.libs.reactivesecurity.exchange; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import no.nav.testnav.libs.reactivesecurity.action.GetAuthenticatedToken; | ||
import no.nav.testnav.libs.reactivesecurity.action.GetAuthenticatedUserId; | ||
import no.nav.testnav.libs.reactivesecurity.exchange.azuread.AzureTokenService; | ||
import no.nav.testnav.libs.reactivesecurity.exchange.azuread.AzureNavTokenService; | ||
import no.nav.testnav.libs.reactivesecurity.exchange.azuread.AzureTrygdeetatenTokenService; | ||
import no.nav.testnav.libs.securitycore.domain.azuread.*; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Primary; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.util.Assert; | ||
|
||
@AutoConfiguration(after = ClientCredentialAutoConfiguration.class) | ||
public class TokenServiceAutoConfiguration { | ||
|
||
@Value("${HTTP_PROXY:#{null}}") | ||
private String httpProxy; | ||
|
||
@Primary | ||
@Bean | ||
@Profile("test") | ||
AzureTokenService azureAdTokenServiceTest( | ||
AzureClientCredential clientCredential, | ||
GetAuthenticatedToken getAuthenticatedToken | ||
) { | ||
return new AzureTokenService(null, null, clientCredential, getAuthenticatedToken); | ||
} | ||
|
||
@Bean | ||
@ConditionalOnDollyApplicationConfiguredForAzure | ||
@ConditionalOnMissingBean(AzureTokenService.class) | ||
AzureTokenService azureAdTokenService( | ||
@Value("${AAD_ISSUER_URI:#{null}}") String issuerUrl, | ||
AzureClientCredential clientCredential, | ||
GetAuthenticatedToken getAuthenticatedToken | ||
) { | ||
Assert.notNull(issuerUrl, "AAD_ISSUER_URI must be set"); | ||
return new AzureTokenService(httpProxy, issuerUrl, clientCredential, getAuthenticatedToken); | ||
} | ||
|
||
@Primary | ||
@Bean | ||
@Profile("test") | ||
AzureNavTokenService azureNavTokenServiceTest( | ||
AzureNavClientCredential azureNavClientCredential | ||
) { | ||
return new AzureNavTokenService(null, azureNavClientCredential); | ||
} | ||
|
||
@Bean | ||
@ConditionalOnDollyApplicationConfiguredForNav | ||
@ConditionalOnMissingBean(AzureNavTokenService.class) | ||
AzureNavTokenService azureNavTokenService( | ||
AzureNavClientCredential azureNavClientCredential | ||
) { | ||
return new AzureNavTokenService(httpProxy, azureNavClientCredential); | ||
} | ||
|
||
@Primary | ||
@Bean | ||
@Profile("test") | ||
AzureTrygdeetatenTokenService trygdeetatenAzureAdTokenServiceTest( | ||
AzureTrygdeetatenClientCredential clientCredential, | ||
GetAuthenticatedUserId getAuthenticatedUserId, | ||
ObjectMapper objectMapper | ||
) { | ||
return new AzureTrygdeetatenTokenService(null, clientCredential, getAuthenticatedUserId, objectMapper); | ||
} | ||
|
||
@Bean | ||
@ConditionalOnDollyApplicationConfiguredForTrygdeetaten | ||
@ConditionalOnMissingBean(AzureTrygdeetatenTokenService.class) | ||
AzureTrygdeetatenTokenService trygdeetatenAzureAdTokenService( | ||
AzureTrygdeetatenClientCredential clientCredential, | ||
GetAuthenticatedUserId getAuthenticatedUserId, | ||
ObjectMapper objectMapper | ||
) { | ||
return new AzureTrygdeetatenTokenService(httpProxy, clientCredential, getAuthenticatedUserId, objectMapper); | ||
} | ||
|
||
} |
44 changes: 23 additions & 21 deletions
44
...hange/azuread/NavAzureAdTokenService.java → ...xchange/azuread/AzureNavTokenService.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
Oops, something went wrong.