Java 8 GSSCredential - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 GSSCredential class.

This code example shows how to use the following methods:getRemainingInitLifetime, getRemainingLifetime
        new OneKDC(null).writeJAASConf(); 
        System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
 
        GSSManager gm = GSSManager.getInstance();
        GSSCredential cred = gm.createCredential(GSSCredential.INITIATE_AND_ACCEPT);
        int time = cred.getRemainingLifetime();
        int time2 = cred.getRemainingInitLifetime(null);
        // The test KDC issues a TGT with a default lifetime of 11 hours 
        int elevenhrs = 11*3600;
        if (time > elevenhrs+60 || time < elevenhrs-60) {
            throw new Exception("getRemainingLifetime returns wrong value.");
        } 
        if (time2 > elevenhrs+60 || time2 < elevenhrs-60) {
            throw new Exception("getRemainingInitLifetime returns wrong value.");
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getRemainingInitLifetime, getRemainingLifetime
        new OneKDC(null).writeJAASConf(); 
        System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
 
        GSSManager gm = GSSManager.getInstance();
        GSSCredential cred = gm.createCredential(GSSCredential.INITIATE_AND_ACCEPT);
        int time = cred.getRemainingLifetime();
        int time2 = cred.getRemainingInitLifetime(null);
        // The test KDC issues a TGT with a default lifetime of 11 hours 
        int elevenhrs = 11*3600;
        if (time > elevenhrs+60 || time < elevenhrs-60) {
            throw new Exception("getRemainingLifetime returns wrong value.");
        } 
        if (time2 > elevenhrs+60 || time2 < elevenhrs-60) {
            throw new Exception("getRemainingInitLifetime returns wrong value.");
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getName
	if (cred == null && name == null) {
	    return null; 
	} 
	Subject subject = new Subject();
	if (cred != null) {
	    subject.getPrivateCredentials().add(cred);
	    if (name == null) {
		GlobusPrincipal nm = toGlobusPrincipal(cred.getName());
		subject.getPrincipals().add(nm);
	    } 
	} 
	if (name != null) {
	    GlobusPrincipal nm = toGlobusPrincipal(name);
	    subject.getPrincipals().add(nm);
	} 
 
	return subject;
    } 
 
    /** 
5
CodeRank
This code example shows how to use the following methods:getName
	throws GSSException {
        if (cred == null) {
            GSSManager manager = ExtendedGSSManager.getInstance();
            cred = manager.createCredential(GSSCredential.INITIATE_AND_ACCEPT);
        } 
        return cred.getName();
    } 
 
    /** 
     * Performs self authorization. 
     */ 
    public void authorize(GSSContext context, String host)
	throws AuthorizationException { 
	logger.debug("Authorization: SELF");
 
	try { 
	    if (!context.getSrcName().equals(context.getTargName())) {
		GSSName expected = null;
		GSSName target = null;
		if (context.isInitiator()) {
4
CodeRank
This code example shows how to use the following methods:getRemainingLifetime
    } 
 
    @Override 
    public void start() throws Exception {
        try { 
            if (credential.getRemainingLifetime() < 60) {
                throw new Exception(
                        "Remaining lifetime of credential is less than a minute."); 
            } 
        } 
        catch (GSSException gsse) {
            throw gsse;
        } 
        try { 
            request.setSpaceToken(configuration.getSpaceToken());
            request.setForceFileRelease(configuration.getForceFileRelease());
            SrmReleaseSpaceResponse response = srmv2.srmReleaseSpace(request);
            if ( response == null ) {
                throw new IOException(" null SrmReleaseSpace");
            } 
4
CodeRank
This code example shows how to use the following methods:getRemainingLifetime
        logger.debug(" put, contacting service {} ", service_url);
        int i = 0;
        while(true) { 
 
            try { 
                if(user_cred.getRemainingLifetime() < 60) {
                    throw new RuntimeException(
                            "credential remaining lifetime is less " + 
                    "than one minute "); 
                } 
            } 
            catch(org.ietf.jgss.GSSException gsse) {
                throw new RuntimeException(gsse);
            } 
 
 
            try { 
                try { 
                    org.dcache.srm.client.axis.RequestStatus rs =
                        axis_isrm.put(sources, dests,
3
CodeRank
See Code Examples for Java 8 GSSCredential Methods: