Examples of CredentialsCache


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

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

      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

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

        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

Examples of sun.security.krb5.internal.ccache.CredentialsCache

        File f = File.createTempFile("ccache", "cc", new File("."));
        FileOutputStream fout = new FileOutputStream(f);
        fout.write(krb5cc);
        fout.close();

        CredentialsCache cc = CredentialsCache.getInstance(f.getPath());
        if (!cc.getDefaultCreds().getServicePrincipal().getNameStrings()[0]
                .equals("krbtgt")) {
            throw new Exception("No TGT found");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.