use of org.pac4j.kerberos.profile.KerberosProfile in project pac4j by pac4j.
the class KerberosClientsKerbyTests method checkWithGoodTicket.
private void checkWithGoodTicket(Client<KerberosCredentials, KerberosProfile> client) throws Exception {
String spnegoWebTicket = SpnegoServiceTicketHelper.getGSSTicket(clientPrincipal, clientPassword, serviceName);
// mock web request
final MockWebContext context = mockWebRequestContext(spnegoWebTicket);
final KerberosCredentials credentials = client.getCredentials(context);
assertNotNull(credentials);
System.out.println(credentials);
final KerberosProfile profile = client.getUserProfile(credentials, context);
assertNotNull(profile);
assertEquals(clientPrincipal, profile.getId());
}
use of org.pac4j.kerberos.profile.KerberosProfile in project pac4j by pac4j.
the class KerberosAuthenticator method validate.
@Override
public void validate(KerberosCredentials credentials, WebContext context) {
logger.trace("Try to validate Kerberos Token:" + credentials.getKerberosTicketAsString());
KerberosTicketValidation ticketValidation = this.ticketValidator.validateTicket(credentials.getKerberosTicket());
logger.debug("Kerberos Token validated");
String subject = ticketValidation.username();
logger.debug("Succesfully validated " + subject);
KerberosProfile profile = new KerberosProfile(ticketValidation.getGssContext());
profile.setId(subject);
credentials.setUserProfile(profile);
}
Aggregations