-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jans-auth-server): Duplicate iss and aud on introspection as jwt #…
- Loading branch information
Showing
3 changed files
with
71 additions
and
4 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
50 changes: 50 additions & 0 deletions
50
jans-auth-server/model/src/test/java/io/jans/as/model/jwt/JwtClaimsTest.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,50 @@ | ||
package io.jans.as.model.jwt; | ||
|
||
import com.google.common.collect.Lists; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
/** | ||
* @author Yuriy Z | ||
*/ | ||
public class JwtClaimsTest { | ||
|
||
@Test | ||
public void setClaimObject_whenSetSameValue_shouldNotCreateDuplicate() { | ||
JwtClaims claims = new JwtClaims(); | ||
claims.addAudience("client1"); | ||
|
||
claims.setClaimObject("aud", "client1", false); | ||
assertEquals(claims.getClaim("aud"), "client1"); | ||
} | ||
|
||
@Test | ||
public void setClaimObject_whenSetDifferentValues_shouldCreateCorrectArray() { | ||
JwtClaims claims = new JwtClaims(); | ||
claims.addAudience("client1"); | ||
|
||
claims.setClaimObject("aud", "client2", false); | ||
assertEquals(claims.getClaim("aud"), Lists.newArrayList("client1", "client2")); | ||
} | ||
|
||
@Test | ||
public void setClaimObject_whenSetDifferentValue_shouldCreateCorrectArray() { | ||
JwtClaims claims = new JwtClaims(); | ||
claims.addAudience("client1"); | ||
|
||
claims.setClaimObject("aud", "client2", false); | ||
claims.setClaimObject("aud", "client3", false); | ||
assertEquals(claims.getClaim("aud"), Lists.newArrayList("client1", "client2", "client3")); | ||
} | ||
|
||
@Test | ||
public void setClaimObject_whenSetDifferentValueWithOverride_shouldOverrideValue() { | ||
JwtClaims claims = new JwtClaims(); | ||
claims.addAudience("client1"); | ||
|
||
claims.setClaimObject("aud", "client2", false); | ||
claims.setClaimObject("aud", "client3", true); | ||
assertEquals(claims.getClaim("aud"), "client3"); | ||
} | ||
} |
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