org.jasig.cas.ticket.TicketCreationException Java Examples
The following examples show how to use
org.jasig.cas.ticket.TicketCreationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiFactorAwareCentralAuthenticationService.java From cas-mfa with Apache License 2.0 | 6 votes |
@Override @Audit( action="TICKET_GRANTING_TICKET", actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER", resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER") @Timed(name = "CREATE_TICKET_GRANTING_TICKET_TIMER") @Metered(name = "CREATE_TICKET_GRANTING_TICKET_METER") @Counted(name="CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic=true) public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials) throws TicketException { final MultiFactorCredentials mfaCredentials = (MultiFactorCredentials) credentials[0]; final Authentication authentication = mfaCredentials.getAuthentication(); if (authentication == null) { throw new TicketCreationException(new RuntimeException("Authentication cannot be null")); } final TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl( this.ticketGrantingTicketUniqueTicketIdGenerator.getNewTicketId(TicketGrantingTicket.PREFIX), authentication, this.ticketGrantingTicketExpirationPolicy); this.ticketRegistry.addTicket(ticketGrantingTicket); return ticketGrantingTicket; }
Example #2
Source File: CentralAuthenticationServiceImpl.java From springboot-shiro-cas-mybatis with MIT License | 5 votes |
@Audit( action="TICKET_GRANTING_TICKET", actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER", resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER") @Timed(name = "CREATE_TICKET_GRANTING_TICKET_TIMER") @Metered(name = "CREATE_TICKET_GRANTING_TICKET_METER") @Counted(name="CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic=true) @Override public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials) throws AuthenticationException, TicketException { final Set<Credential> sanitizedCredentials = sanitizeCredentials(credentials); if (sanitizedCredentials.size() > 0) { final Authentication authentication = this.authenticationManager.authenticate(credentials); final TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl( this.ticketGrantingTicketUniqueTicketIdGenerator .getNewTicketId(TicketGrantingTicket.PREFIX), authentication, this.ticketGrantingTicketExpirationPolicy); this.ticketRegistry.addTicket(ticketGrantingTicket); return ticketGrantingTicket; } final String msg = "No credentials were specified in the request for creating a new ticket-granting ticket"; logger.warn(msg); throw new TicketCreationException(new IllegalArgumentException(msg)); }
Example #3
Source File: CentralAuthenticationServiceImplTests.java From springboot-shiro-cas-mybatis with MIT License | 4 votes |
@Test(expected=TicketCreationException.class) public void disallowNullCredentionalsWhenCreatingTicketGrantingTicket() throws Exception { final TicketGrantingTicket ticketId = getCentralAuthenticationService() .createTicketGrantingTicket(null); }
Example #4
Source File: CentralAuthenticationServiceImplTests.java From springboot-shiro-cas-mybatis with MIT License | 4 votes |
@Test(expected=TicketCreationException.class) public void disallowNullCredentionalsArrayWhenCreatingTicketGrantingTicket() throws Exception { final TicketGrantingTicket ticketId = getCentralAuthenticationService() .createTicketGrantingTicket(new Credential[] {null, null}); }