Package javax.security.auth

Examples of javax.security.auth.RefreshFailedException


    public void refresh() throws RefreshFailedException {

        checkState();

        if (!flags[RENEWABLE]) {
            throw new RefreshFailedException(Messages.getString("auth.44")); //$NON-NLS-1$
        }

        if (System.currentTimeMillis() > this.renewTill.getTime()) {
            throw new RefreshFailedException(Messages.getString("auth.45")); //$NON-NLS-1$
        }

        //TODO: need access to a KDC server         
        throw new UnsupportedOperationException();
    }
View Full Code Here


     * @see #getRenewTill()
     */
    public void refresh() throws RefreshFailedException {

  if (destroyed)
      throw new RefreshFailedException("A destroyed ticket "
               + "cannot be renewd.");

  if (!isRenewable())
      throw new RefreshFailedException("This ticket is not renewable");

  if (System.currentTimeMillis() > getRenewTill().getTime())
      throw new RefreshFailedException("This ticket is past "
               + "its last renewal time.");
  Throwable e = null;
  sun.security.krb5.Credentials krb5Creds = null;

  try {
      krb5Creds = new sun.security.krb5.Credentials(asn1Encoding,
                client.toString(),
                server.toString(),
                sessionKey.getEncoded(),
                sessionKey.getKeyType(),
                flags,
                authTime,
                startTime,
                endTime,
                renewTill,
                clientAddresses);
      krb5Creds = krb5Creds.renew();
  } catch (sun.security.krb5.KrbException krbException) {
      e = krbException;
  } catch (java.io.IOException ioException) {
      e = ioException;
  }

  if (e != null) {
      RefreshFailedException rfException
    = new RefreshFailedException("Failed to renew Kerberos Ticket "
               + "for client " + client
               + " and server " + server
               + " - " + e.getMessage());
      rfException.initCause(e);
      throw rfException;
  }

  /*
   * In case multiple threads try to refresh it at the same time.
View Full Code Here

     * @see #getRenewTill()
     */
    public void refresh() throws RefreshFailedException {

        if (destroyed)
            throw new RefreshFailedException("A destroyed ticket "
                                             + "cannot be renewd.");

        if (!isRenewable())
            throw new RefreshFailedException("This ticket is not renewable");

        if (System.currentTimeMillis() > getRenewTill().getTime())
            throw new RefreshFailedException("This ticket is past "
                                             + "its last renewal time.");
        Throwable e = null;
        sun.security.krb5.Credentials krb5Creds = null;

        try {
            krb5Creds = new sun.security.krb5.Credentials(asn1Encoding,
                                                    client.toString(),
                                                    server.toString(),
                                                    sessionKey.getEncoded(),
                                                    sessionKey.getKeyType(),
                                                    flags,
                                                    authTime,
                                                    startTime,
                                                    endTime,
                                                    renewTill,
                                                    clientAddresses);
            krb5Creds = krb5Creds.renew();
        } catch (sun.security.krb5.KrbException krbException) {
            e = krbException;
        } catch (java.io.IOException ioException) {
            e = ioException;
        }

        if (e != null) {
            RefreshFailedException rfException
                = new RefreshFailedException("Failed to renew Kerberos Ticket "
                                             + "for client " + client
                                             + " and server " + server
                                             + " - " + e.getMessage());
            rfException.initCause(e);
            throw rfException;
        }

        /*
         * In case multiple threads try to refresh it at the same time.
View Full Code Here

public class RefreshFailedExceptionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        return new Object[] {new RefreshFailedException("message")};
    }
View Full Code Here

    /**
     * @tests javax.security.auth.RefreshFailedException#RefreshFailedException()
     */
    public final void testCtor1() {
        assertNull(new RefreshFailedException().getMessage());
    }
View Full Code Here

    /**
     * @tests javax.security.auth.RefreshFailedException#RefreshFailedException(
     *        java.lang.String)
     */
    public final void testCtor2() {
        assertNull(new RefreshFailedException(null).getMessage());

        String message = "";
        assertSame(message, new RefreshFailedException(message).getMessage());

        message = "message";
        assertSame(message, new RefreshFailedException(message).getMessage());
    }
View Full Code Here

      }
     
    }
    catch ( Exception ex)
    {
      RefreshFailedException exception = new RefreshFailedException();
      exception.initCause(ex);
      throw exception;
    }
   
  }
View Full Code Here

     * @see #getRenewTill()
     */
    public void refresh() throws RefreshFailedException {

        if (destroyed)
            throw new RefreshFailedException("A destroyed ticket "
                                             + "cannot be renewd.");

        if (!isRenewable())
            throw new RefreshFailedException("This ticket is not renewable");

        if (System.currentTimeMillis() > getRenewTill().getTime())
            throw new RefreshFailedException("This ticket is past "
                                             + "its last renewal time.");
        Throwable e = null;
        sun.security.krb5.Credentials krb5Creds = null;

        try {
            krb5Creds = new sun.security.krb5.Credentials(asn1Encoding,
                                                    client.toString(),
                                                    server.toString(),
                                                    sessionKey.getEncoded(),
                                                    sessionKey.getKeyType(),
                                                    flags,
                                                    authTime,
                                                    startTime,
                                                    endTime,
                                                    renewTill,
                                                    clientAddresses);
            krb5Creds = krb5Creds.renew();
        } catch (sun.security.krb5.KrbException krbException) {
            e = krbException;
        } catch (java.io.IOException ioException) {
            e = ioException;
        }

        if (e != null) {
            RefreshFailedException rfException
                = new RefreshFailedException("Failed to renew Kerberos Ticket "
                                             + "for client " + client
                                             + " and server " + server
                                             + " - " + e.getMessage());
            rfException.initCause(e);
            throw rfException;
        }

        /*
         * In case multiple threads try to refresh it at the same time.
View Full Code Here

    public void refresh() throws RefreshFailedException {

        checkState();

        if (!flags[RENEWABLE]) {
            throw new RefreshFailedException(Messages.getString("auth.44")); //$NON-NLS-1$
        }

        if (System.currentTimeMillis() > this.renewTill.getTime()) {
            throw new RefreshFailedException(Messages.getString("auth.45")); //$NON-NLS-1$
        }

        try {
            KrbClient.doTGS();
        } catch (KerberosException e) {
            throw new RefreshFailedException(e.getMessage());
        }
    }
View Full Code Here

    /**
     * @tests javax.security.auth.RefreshFailedException#RefreshFailedException()
     */
    public final void testCtor1() {
        assertNull(new RefreshFailedException().getMessage());
    }
View Full Code Here

TOP

Related Classes of javax.security.auth.RefreshFailedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.