Package org.apache.directory.kerberos.credentials.cache

Examples of org.apache.directory.kerberos.credentials.cache.CredentialsCache


      kinit.setCredCacheFile( ccFile );
     
      kinit.kinit(principalName, userPassword);
      System.out.println( "Kinit generated file " + ccFile.getAbsolutePath() );
     
      CredentialsCache credCache = CredentialsCache.load( ccFile );     
        assertNotNull( credCache );
    }
View Full Code Here


      byte[] sampleCache = SampleCredentialsCacheResource.getCacheContent();
      ByteArrayInputStream bais = new ByteArrayInputStream(sampleCache);
           
        try
        {
          CredentialsCache cc = CredentialsCache.load(bais);
         
            PrincipalName principal = cc.getPrimaryPrincipalName();
            assertTrue( principal.getNameString().equals( SampleCredentialsCacheResource.getSamplePrincipal() ) );
            assertTrue( principal.getRealm().equals( SampleCredentialsCacheResource.getSampleRealm() ) );
           
            assertTrue( cc.getCredsList().size() == SampleCredentialsCacheResource.getSampleTicketsCount() );
           
            Set<String> servers = new HashSet<String>();
            for (String server : SampleCredentialsCacheResource.getSampleServers())
            {
              servers.add( server );
            }
           
            String tktServer;
            for (Credentials cred : cc.getCredsList()) {
              tktServer = cred.getTicket().getSName().getNameString();
              assertTrue( servers.contains( tktServer ) );
            }
        }
        catch ( Exception ike )
View Full Code Here

        throw new IllegalArgumentException( "Invalid principal, password, or credentials cache file" );
      }
     
      TgTicket tgt = kdc.getTgt( principal, password );
     
      CredentialsCache credCache = new CredentialsCache();
     
      PrincipalName princ = new PrincipalName( principal, PrincipalNameType.KRB_NT_PRINCIPAL );
      princ.setRealm( tgt.getRealm() );
      credCache.setPrimaryPrincipalName( princ );
     
      Credentials cred = new Credentials( tgt );
      credCache.addCredentials( cred );
     
      CredentialsCache.store( credCacheFile, credCache );
    }   
View Full Code Here

TOP

Related Classes of org.apache.directory.kerberos.credentials.cache.CredentialsCache

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.