CustomUAMCasValidatorTest

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-12-02 14:37:44 +01:00
parent 20d261635b
commit c24aa73bb0
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -0,0 +1,28 @@
package com.plannaplan.security.cas;
import org.junit.Test;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
import org.jasig.cas.client.validation.TicketValidationException;
public class CustomUAMCasValidatorTest {
@Test
public void shouldValidateWithDomain() {
/*
* TO DO
* Dodać case z CAS10/CAS20/CAS30
*/
Cas20ServiceTicketValidator validator = new Cas20ServiceTicketValidator("https://cas.amu.edu.pl/cas");
try {
Assertion assertion = validator.validate("ST-53723-d0gcC3qovlJhhnKZBhTN-cas.amu.edu.pl","https://wmi.plannaplan.pl");
if (assertion == null) {
throw new CasValidationExcepiton("Validation failed. Assertion could not be retrieved for ticket " + "");
}
} catch (TicketValidationException e) {
e.printStackTrace();
}
}
}