Skip to content

Commit

Permalink
Endret oppslag av client ID/secret til å hente verdi fra NAIS-variabl…
Browse files Browse the repository at this point in the history
…er hvis satt.
  • Loading branch information
rfc3092 committed Dec 9, 2024
1 parent d307c60 commit ae480a4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
* Get configuration from, in prioritized order:
* <ol>
* <li>{@code AZURE_APP_CLIENT_[ID|SECRET]} (provided by NAIS when running in pod)</li>
* <li>{@code spring.security.oauth2.client.registration.aad.client-[id|secret]} (configured when running locally)</li>
* <li>{@code null} (for test purposes)</li>
* </ol>
*/
@Configuration
public class AzureNavClientCredential extends ClientCredential {

public AzureNavClientCredential(
@Value("${spring.security.oauth2.client.registration.aad.client-id:#{null}}") String clientId,
@Value("${spring.security.oauth2.client.registration.aad.client-secret:#{null}}") String clientSecret
@Value("#{systemProperties['AZURE_APP_CLIENT_ID'] ?: '${spring.security.oauth2.client.registration.aad.client-id:#{null}}'}") String clientId,
@Value("#{systemProperties['AZURE_APP_CLIENT_SECRET'] ?: '${spring.security.oauth2.client.registration.aad.client-secret:#{null}}'}") String clientSecret
) {
super(clientId, clientSecret);
}
Expand Down

0 comments on commit ae480a4

Please sign in to comment.