-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* nullability and sealing * nullability and sealing * nullability and sealing * nullability and sealing
- Loading branch information
1 parent
093a28e
commit e20f7d1
Showing
15 changed files
with
69 additions
and
57 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
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
6 changes: 3 additions & 3 deletions
6
...main/kotlin/no/nav/security/token/support/client/core/oauth2/OAuth2AccessTokenResponse.kt
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,7 +1,7 @@ | ||
package no.nav.security.token.support.client.core.oauth2 | ||
|
||
data class OAuth2AccessTokenResponse (var access_token : String? = null, var expires_at : Int? = null, var expires_in : Int? = 60, private val additionalParameters : Map<String, Any> = emptyMap()) { | ||
val accessToken get() = access_token | ||
val expiresAt get() = expires_at | ||
val expiresIn get() = expires_in | ||
val accessToken = access_token | ||
val expiresAt = expires_at | ||
val expiresIn = expires_in | ||
} |
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
19 changes: 13 additions & 6 deletions
19
...e/src/main/kotlin/no/nav/security/token/support/client/core/oauth2/TokenExchangeClient.kt
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,20 +1,27 @@ | ||
package no.nav.security.token.support.client.core.oauth2 | ||
|
||
import com.nimbusds.oauth2.sdk.GrantType | ||
import no.nav.security.token.support.client.core.ClientProperties.TokenExchangeProperties.Companion.SUBJECT_TOKEN_TYPE_VALUE | ||
import no.nav.security.token.support.client.core.OAuth2ClientException | ||
import no.nav.security.token.support.client.core.OAuth2ParameterNames | ||
import no.nav.security.token.support.client.core.OAuth2ParameterNames.AUDIENCE | ||
import no.nav.security.token.support.client.core.OAuth2ParameterNames.RESOURCE | ||
import no.nav.security.token.support.client.core.OAuth2ParameterNames.SCOPE | ||
import no.nav.security.token.support.client.core.OAuth2ParameterNames.SUBJECT_TOKEN | ||
import no.nav.security.token.support.client.core.OAuth2ParameterNames.SUBJECT_TOKEN_TYPE | ||
import no.nav.security.token.support.client.core.http.OAuth2HttpClient | ||
|
||
class TokenExchangeClient(oAuth2HttpClient : OAuth2HttpClient) : AbstractOAuth2TokenClient<TokenExchangeGrantRequest>(oAuth2HttpClient) { | ||
|
||
override fun formParameters(grantRequest : TokenExchangeGrantRequest) = | ||
LinkedHashMap<String, String>().apply { | ||
grantRequest.clientProperties.tokenExchange.run { | ||
put(SUBJECT_TOKEN_TYPE, this!!.subjectTokenType()) | ||
put(SUBJECT_TOKEN,grantRequest.subjectToken) | ||
put(AUDIENCE, audience) | ||
resource?.takeIf { it.isNotEmpty() }?.let { put(RESOURCE, it) } | ||
with(grantRequest) { | ||
HashMap<String, String>().apply { | ||
clientProperties.tokenExchange?.run { | ||
put(SUBJECT_TOKEN_TYPE, SUBJECT_TOKEN_TYPE_VALUE) | ||
put(SUBJECT_TOKEN,subjectToken) | ||
put(AUDIENCE, audience) | ||
resource?.takeIf { it.isNotEmpty() }?.let { put(RESOURCE, it) } | ||
} | ||
} | ||
} | ||
} |
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.