Ejemplo n.º 1
0
        /**
         * Constructs a new ServiceTicket with a Unique Id, a TicketGrantingTicket,
         * a Service, Expiration Policy and a flag to determine if the ticket
         * creation was from a new Login or not.
         *
         * @param id the unique identifier for the ticket.
         * @param ticket the TicketGrantingTicket parent.
         * @param service the service this ticket is for.
         * @param fromNewLogin is it from a new login.
         * @param policy the expiration policy for the Ticket.
         * @throws IllegalArgumentException if the TicketGrantingTicket or the
         * Service are null.
         */
        public ServiceTicketImpl(string id,
                                 TicketGrantingTicketImpl ticket, Service service,
                                 bool fromNewLogin, ExpirationPolicy policy)
            : base(id, ticket, policy)
        {
            //Assert.notNull(ticket, "ticket cannot be null");
            //Assert.notNull(service, "service cannot be null");

            this.service      = service;
            this.fromNewLogin = fromNewLogin;
        }
        /**
         * Constructs a new TicketGrantingTicket.
         *
         * @param id the id of the Ticket
         * @param ticketGrantingTicket the parent ticket
         * @param authentication the Authentication request for this ticket
         * @param policy the expiration policy for this ticket.
         * @throws IllegalArgumentException if the Authentication object is null
         */
        public TicketGrantingTicketImpl(string id,
                                        TicketGrantingTicketImpl ticketGrantingTicket,
                                        Authentication authentication, ExpirationPolicy policy)
            : base(id, ticketGrantingTicket, policy)
        {
            //base(id, ticketGrantingTicket, policy);

            //Assert.notNull(authentication, "authentication cannot be null");

            this.authentication = authentication;
        }
Ejemplo n.º 3
0
        /**
     * Constructs a new Ticket with a unique id, a possible parent Ticket (can
     * be null) and a specified Expiration Policy.
     * 
     * @param id the unique identifier for the ticket
     * @param ticket the parent TicketGrantingTicket
     * @param expirationPolicy the expiration policy for the ticket.
     * @throws IllegalArgumentException if the id or expiration policy is null.
     */
        public AbstractTicket(string id, TicketGrantingTicketImpl ticket,
                              ExpirationPolicy expirationPolicy)
        {
            //Assert.notNull(expirationPolicy, "expirationPolicy cannot be null");
            //Assert.notNull(id, "id cannot be null");

            this.id = id;
            this.creationTime = System.DateTime.Now.Ticks;
            this.lastTimeUsed = System.DateTime.Now.Ticks;
            this.expirationPolicy = expirationPolicy;
            this.ticketGrantingTicket = ticket;
        }
Ejemplo n.º 4
0
        /**
     * Constructs a new Ticket with a unique id, a possible parent Ticket (can
     * be null) and a specified Expiration Policy.
     * 
     * @param id the unique identifier for the ticket
     * @param ticket the parent TicketGrantingTicket
     * @param expirationPolicy the expiration policy for the ticket.
     * @throws IllegalArgumentException if the id or expiration policy is null.
     */
        public AbstractTicket(string id, TicketGrantingTicketImpl ticket,
                              ExpirationPolicy expirationPolicy)
        {
            //Assert.notNull(expirationPolicy, "expirationPolicy cannot be null");
            //Assert.notNull(id, "id cannot be null");

            this.id = id;
            this.creationTime = System.DateTime.Now.Ticks;
            this.lastTimeUsed = System.DateTime.Now.Ticks;
            this.expirationPolicy = expirationPolicy;
            this.ticketGrantingTicket = ticket;
        }
Ejemplo n.º 5
0
        /**
     * Constructs a new ServiceTicket with a Unique Id, a TicketGrantingTicket,
     * a Service, Expiration Policy and a flag to determine if the ticket
     * creation was from a new Login or not.
     * 
     * @param id the unique identifier for the ticket.
     * @param ticket the TicketGrantingTicket parent.
     * @param service the service this ticket is for.
     * @param fromNewLogin is it from a new login.
     * @param policy the expiration policy for the Ticket.
     * @throws IllegalArgumentException if the TicketGrantingTicket or the
     * Service are null.
     */
        public ServiceTicketImpl(string id,
                                     TicketGrantingTicketImpl ticket, Service service,
                                     bool fromNewLogin, ExpirationPolicy policy)
            : base(id, ticket, policy)
        {


            //Assert.notNull(ticket, "ticket cannot be null");
            //Assert.notNull(service, "service cannot be null");

            this.service = service;
            this.fromNewLogin = fromNewLogin;
        }
        /**
     * @throws IllegalArgumentException if the credentials are null.
     */
        //@Audit(
        //    action="TICKET_GRANTING_TICKET",
        //    actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER",
        //    resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
        //@Profiled(tag = "CREATE_TICKET_GRANTING_TICKET", logFailuresSeparately = false)
        //@Transactional(readOnly = false)
        public string createTicketGrantingTicket(Credentials credentials)
        {
            //Assert.notNull(credentials, "credentials cannot be null");

            try
            {
                Authentication authentication = this.authenticationManager
                    .authenticate(credentials);

                TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl(
                    this.ticketGrantingTicketUniqueTicketIdGenerator
                        .getNewTicketId(TicketPrefix.TicketGrantingTicket_PREFIX),
                    authentication, this.ticketGrantingTicketExpirationPolicy);

                this.ticketRegistry.addTicket(ticketGrantingTicket);
                return ticketGrantingTicket.getId();
            }
            catch (AuthenticationException e)
            {
                throw new TicketCreationException(e);
            }
        }
Ejemplo n.º 7
0
        /**
     * Constructs a new TicketGrantingTicket.
     * 
     * @param id the id of the Ticket
     * @param ticketGrantingTicket the parent ticket
     * @param authentication the Authentication request for this ticket
     * @param policy the expiration policy for this ticket.
     * @throws IllegalArgumentException if the Authentication object is null
     */
        public TicketGrantingTicketImpl(string id,
                                        TicketGrantingTicketImpl ticketGrantingTicket,
                                        Authentication authentication, ExpirationPolicy policy)
            : base(id, ticketGrantingTicket, policy)
        {
            //base(id, ticketGrantingTicket, policy);

            //Assert.notNull(authentication, "authentication cannot be null");

            this.authentication = authentication;
        }