當前位置: 首頁>>代碼示例>>Java>>正文


Java GSSName.toString方法代碼示例

本文整理匯總了Java中org.ietf.jgss.GSSName.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java GSSName.toString方法的具體用法?Java GSSName.toString怎麽用?Java GSSName.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.ietf.jgss.GSSName的用法示例。


在下文中一共展示了GSSName.toString方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: authenticate

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Principal authenticate(GSSContext gssContext, boolean storeCreds) {
    if (gssContext.isEstablished()) {
        String username = null;
        GSSName name = null;
        try {
            name = gssContext.getSrcName();
        } catch (GSSException e) {
            log.warn(sm.getString("realmBase.gssNameFail"), e);
            return null;
        }
        
        username = name.toString();
        
        Principal authenticatedUser = super.authenticate(gssContext, storeCreds);
            
        return filterLockedAccounts(username, authenticatedUser);
    }
    
    // Fail in all other cases
    return null;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:26,代碼來源:LockOutRealm.java

示例2: authenticate

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Principal authenticate(GSSContext gssContext, boolean storeCreds) {
	if (gssContext.isEstablished()) {
		String username = null;
		GSSName name = null;
		try {
			name = gssContext.getSrcName();
		} catch (GSSException e) {
			log.warn(sm.getString("realmBase.gssNameFail"), e);
			return null;
		}

		username = name.toString();

		Principal authenticatedUser = super.authenticate(gssContext, storeCreds);

		return filterLockedAccounts(username, authenticatedUser);
	}

	// Fail in all other cases
	return null;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:26,代碼來源:LockOutRealm.java

示例3: getUsernameFromGSSContext

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
private static String getUsernameFromGSSContext(final GSSContext gssContext, final boolean strip, final ESLogger logger) {
    if (gssContext.isEstablished()) {
        GSSName gssName = null;
        try {
            gssName = gssContext.getSrcName();
        } catch (final GSSException e) {
            logger.error("Unable to get src name from gss context", e);
        }

        if (gssName != null) {
            String name = gssName.toString();

            return stripRealmName(name, strip);

        }
    }

    return null;
}
 
開發者ID:codecentric,項目名稱:elasticsearch-shield-kerberos-realm,代碼行數:20,代碼來源:KerberosRealm.java

示例4: GSSAuthentication

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
public GSSAuthentication(byte[] token) throws GSSException {
	GSSManager gssManager = GSSManager.getInstance();
	GSSCredential gssCreds = gssManager.createCredential(
			(GSSName) null, GSSCredential.INDEFINITE_LIFETIME,
			(Oid) null, GSSCredential.ACCEPT_ONLY);
	GSSContext gssContext = gssManager.createContext(gssCreds);

	responseToken = gssContext
			.acceptSecContext(token, 0, token.length);

	if (gssContext.isEstablished()) {
		GSSName name = gssContext.getSrcName();
		username = name.toString();
	}
}
 
開發者ID:cbsit,項目名稱:JaasLounge,代碼行數:16,代碼來源:GSSAuthentication.java

示例5: getUsernameFromGSSContext

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
private String getUsernameFromGSSContext(final GSSContext gssContext, final boolean strip) {
    if (gssContext.isEstablished()) {
        GSSName gssName = null;
        try {
            gssName = gssContext.getSrcName();
        } catch (final GSSException e) {
            log.warn("realmBase.gssNameFail", e);
        }

        if (gssName != null) {
            String name = gssName.toString();

            if (strip && name != null) {
                final int i = name.indexOf('@');
                if (i > 0) {
                    // Zero so we don;t leave a zero length name
                    name = name.substring(0, i);
                }
            }

            return name;

        }
    }

    return null;
}
 
開發者ID:petalmd,項目名稱:armor,代碼行數:28,代碼來源:HTTPSpnegoAuthenticator.java

示例6: authenticate

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Principal authenticate(GSSContext gssContext, boolean storeCreds) {
    if (gssContext.isEstablished()) {
        String username = null;
        GSSName name = null;
        try {
            name = gssContext.getSrcName();
        } catch (GSSException e) {
            log.warn(sm.getString("realmBase.gssNameFail"), e);
            return null;
        }
        
        username = name.toString();
        
        if (isLocked(username)) {
            // Trying to authenticate a locked user is an automatic failure
            registerAuthFailure(username);
            
            log.warn(sm.getString("lockOutRealm.authLockedUser", username));
            return null;
        }

        Principal authenticatedUser =
                super.authenticate(gssContext, storeCreds);
        
        if (authenticatedUser == null) {
            registerAuthFailure(username);
        } else {
            registerAuthSuccess(username);
        }
        return authenticatedUser;
    }
    
    // Fail in all other cases
    return null;
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:40,代碼來源:LockOutRealm.java

示例7: authenticate

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Principal authenticate(GSSContext gssContext, boolean storeCreds) {
    if (gssContext.isEstablished()) {
        Principal authenticatedUser = null;
        String username = null;
        
        GSSName name = null;
        try {
            name = gssContext.getSrcName();
        } catch (GSSException e) {
            log.warn(sm.getString("realmBase.gssNameFail"), e);
            return null;
        }
        
        username = name.toString();

        for (Realm realm : realms) {
            if (log.isDebugEnabled()) {
                log.debug(sm.getString("combinedRealm.authStart",
                        username, realm.getInfo()));
            }

            authenticatedUser = realm.authenticate(gssContext, storeCreds);

            if (authenticatedUser == null) {
                if (log.isDebugEnabled()) {
                    log.debug(sm.getString("combinedRealm.authFail",
                            username, realm.getInfo()));
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug(sm.getString("combinedRealm.authSuccess",
                            username, realm.getInfo()));
                }
                break;
            }
        }
        return authenticatedUser;
    }
    
    // Fail in all other cases
    return null;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:47,代碼來源:CombinedRealm.java

示例8: authenticate

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Principal authenticate(GSSContext gssContext, boolean storeCreds) {
	if (gssContext.isEstablished()) {
		Principal authenticatedUser = null;
		String username = null;

		GSSName name = null;
		try {
			name = gssContext.getSrcName();
		} catch (GSSException e) {
			log.warn(sm.getString("realmBase.gssNameFail"), e);
			return null;
		}

		username = name.toString();

		for (Realm realm : realms) {
			if (log.isDebugEnabled()) {
				log.debug(sm.getString("combinedRealm.authStart", username, realm.getInfo()));
			}

			authenticatedUser = realm.authenticate(gssContext, storeCreds);

			if (authenticatedUser == null) {
				if (log.isDebugEnabled()) {
					log.debug(sm.getString("combinedRealm.authFail", username, realm.getInfo()));
				}
			} else {
				if (log.isDebugEnabled()) {
					log.debug(sm.getString("combinedRealm.authSuccess", username, realm.getInfo()));
				}
				break;
			}
		}
		return authenticatedUser;
	}

	// Fail in all other cases
	return null;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:44,代碼來源:CombinedRealm.java

示例9: toGlobusPrincipal

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
    * Converts the specified GSSName to GlobusPrincipal.
    * The GSSName is converted into the GlobusPrincipal
    * only if the GSSName is of type 
    * <code>org.globus.gsi.gssapi.GlobusGSSName</code> 
    * and the name is not anonymous.
    */
   public static GlobusPrincipal toGlobusPrincipal(GSSName name) {
return (!name.isAnonymous() &&
	(name instanceof GlobusGSSName)) ?
    new GlobusPrincipal(name.toString()) :
    null;
   }
 
開發者ID:NCIP,項目名稱:cagrid-general,代碼行數:14,代碼來源:JaasGssUtil.java


注:本文中的org.ietf.jgss.GSSName.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。