-
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.
feat(jans-auth-server): improve client assertion creation code (Clien…
…tAuthnRequest) #1182
- Loading branch information
Showing
2 changed files
with
38 additions
and
2 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
32 changes: 32 additions & 0 deletions
32
jans-auth-server/client/src/test/java/io/jans/as/client/ClientAuthnRequestTest.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,32 @@ | ||
package io.jans.as.client; | ||
|
||
import io.jans.as.model.crypto.signature.SignatureAlgorithm; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
/** | ||
* @author Yuriy Zabrovarnyy | ||
*/ | ||
public class ClientAuthnRequestTest { | ||
|
||
@Test | ||
public void getFallbackAlgorithm_whenKidIsBlank_shouldReturnHS256() { | ||
ClientAuthnRequest request = new TestClientAuthnRequest(); | ||
assertEquals(request.getFallbackAlgorithm(), SignatureAlgorithm.HS256); | ||
} | ||
|
||
@Test | ||
public void getFallbackAlgorithm_whenKidIsNotBlank_shouldReturnRS256() { | ||
ClientAuthnRequest request = new TestClientAuthnRequest(); | ||
request.setKeyId("testKid"); | ||
assertEquals(request.getFallbackAlgorithm(), SignatureAlgorithm.RS256); | ||
} | ||
|
||
public static class TestClientAuthnRequest extends ClientAuthnRequest { | ||
@Override | ||
public String getQueryString() { | ||
return ""; | ||
} | ||
} | ||
} |