File tree Expand file tree Collapse file tree
test/java/com/descope/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 runs-on : ubuntu-latest
99 steps :
1010 - name : Checkout Code
11- uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 .0.3
11+ uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 .0.0
1212 - name : Set up JDK 17
13- uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2 .0
13+ uses : actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3 .0
1414 with :
1515 distribution : " zulu"
1616 java-version : " 17"
Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ jobs:
2323 # Steps represent a sequence of tasks that will be executed as part of the job
2424 steps :
2525 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 .0.3
26+ - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 .0.0
2727
2828 - name : Setup detekt
29- uses : peter-murray/setup-detekt@26449609a63e843a5b9bad8a4b63ef0ee717f7a5 # v3 .0.0
29+ uses : peter-murray/setup-detekt@4c0b45d6dac2620e84abd4ea7008a8a140b9f20a # v4 .0.0
3030 with :
3131 detekt_version : 1.23
3232
Original file line number Diff line number Diff line change 99 contents : read
1010 packages : write
1111 steps :
12- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 .0.3
12+ - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 .0.0
1313 - name : Set up JDK 17
14- uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2 .0
14+ uses : actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3 .0
1515 with :
1616 distribution : " zulu"
1717 java-version : " 17"
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ internal data class JwtServerResponse(
2121 val cookiePath : String ,
2222 val cookieName : String? ,
2323 val sessionCookieName : String? ,
24+ val externalToken : String? ,
2425) {
2526 companion object {
2627 fun fromJson (json : String , cookies : List <HttpCookie >) = JSONObject (json).run {
@@ -49,6 +50,7 @@ internal data class JwtServerResponse(
4950 cookiePath = stringOrEmptyAsNull(" cookiePath" ) ? : " " ,
5051 cookieName = cookieName,
5152 sessionCookieName = sessionCookieName,
53+ externalToken = stringOrEmptyAsNull(" externalToken" ),
5254 )
5355 }
5456 }
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ internal fun JwtServerResponse.convert(): AuthenticationResponse {
6161 sessionToken = Token (sessionJwt),
6262 user = user.convert(),
6363 isFirstAuthentication = firstSeen,
64+ externalToken = externalToken,
6465 )
6566}
6667
Original file line number Diff line number Diff line change @@ -9,12 +9,14 @@ import com.descope.session.DescopeToken
99 * @property refreshToken the refresh token is used to refresh expired session tokens.
1010 * @property isFirstAuthentication whether this the user's first authentication.
1111 * @property user information about the user.
12+ * @property externalToken a token provided by an external token connector, when configured in the project.
1213 */
1314data class AuthenticationResponse (
1415 val sessionToken : DescopeToken ,
1516 val refreshToken : DescopeToken ,
1617 val isFirstAuthentication : Boolean ,
1718 val user : DescopeUser ,
19+ val externalToken : String? = null ,
1820)
1921
2022/* *
Original file line number Diff line number Diff line change 1+ package com.descope.internal.http
2+
3+ import org.junit.Assert.*
4+ import org.junit.Test
5+
6+ class JwtServerResponseTest {
7+
8+ @Test
9+ fun externalToken_populatedWhenPresent () {
10+ val json = """
11+ {
12+ "sessionJwt": "session",
13+ "refreshJwt": "refresh",
14+ "firstSeen": true,
15+ "externalToken": "ext-token-value"
16+ }
17+ """ .trimIndent()
18+ val response = JwtServerResponse .fromJson(json, emptyList())
19+ assertEquals(" ext-token-value" , response.externalToken)
20+ }
21+
22+ @Test
23+ fun externalToken_nullWhenAbsent () {
24+ val json = """
25+ {
26+ "sessionJwt": "session",
27+ "refreshJwt": "refresh",
28+ "firstSeen": true
29+ }
30+ """ .trimIndent()
31+ val response = JwtServerResponse .fromJson(json, emptyList())
32+ assertNull(response.externalToken)
33+ }
34+ }
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ internal val mockJwtResponse = JwtServerResponse(
111111 cookiePath = " /path" ,
112112 cookieName = null ,
113113 sessionCookieName = null ,
114+ externalToken = null ,
114115)
115116
116117private object MockInfo: SystemInfo {
You can’t perform that action at this time.
0 commit comments