本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}