当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationFailedException类代码示例

本文整理汇总了Java中com.gemstone.gemfire.security.AuthenticationFailedException的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationFailedException类的具体用法?Java AuthenticationFailedException怎么用?Java AuthenticationFailedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AuthenticationFailedException类属于com.gemstone.gemfire.security包,在下文中一共展示了AuthenticationFailedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authenticate

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public Principal authenticate(Properties props, DistributedMember member)
    throws AuthenticationFailedException {

  String userName = props.getProperty(UserPasswordAuthInit.USER_NAME);
  if (userName == null) {
    throw new AuthenticationFailedException(
        "DummyAuthenticator: user name property ["
            + UserPasswordAuthInit.USER_NAME + "] not provided");
  }
  String password = props.getProperty(UserPasswordAuthInit.PASSWORD);
  if (password == null) {
    throw new AuthenticationFailedException(
        "DummyAuthenticator: password property ["
            + UserPasswordAuthInit.PASSWORD + "] not provided");
  }

  if (userName.equals(password) && testValidName(userName)) {
    return new UsernamePrincipal(userName);
  }
  else {
    throw new AuthenticationFailedException(
        "DummyAuthenticator: Invalid user name [" + userName
            + "], password supplied.");
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:26,代码来源:DummyAuthenticator.java

示例2: getCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public Properties getCredentials(Properties props, DistributedMember server,
    boolean isPeer) throws AuthenticationFailedException {

  Properties newProps = new Properties();
  String userName = props.getProperty(USER_NAME);
  if (userName == null) {
    throw new AuthenticationFailedException(
        "UserPasswordAuthInit: user name property [" + USER_NAME
            + "] not set.");
  }
  newProps.setProperty(USER_NAME, userName);
  String passwd = props.getProperty(PASSWORD);
  // If password is not provided then use empty string as the password.
  if (passwd == null) {
    passwd = "";
  }
  newProps.setProperty(PASSWORD, passwd);
  return newProps;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:20,代码来源:UserPasswordAuthInit.java

示例3: init

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public void init(Properties securityProps, LogWriter systemLogger,
    LogWriter securityLogger) throws AuthenticationFailedException {
  this.ldapServer = securityProps.getProperty(LDAP_SERVER_NAME);
  if (this.ldapServer == null || this.ldapServer.length() == 0) {
    throw new AuthenticationFailedException(
        "LdapUserAuthenticator: LDAP server property [" + LDAP_SERVER_NAME
            + "] not specified");
  }
  this.basedn = securityProps.getProperty(LDAP_BASEDN_NAME);
  if (this.basedn == null || this.basedn.length() == 0) {
    throw new AuthenticationFailedException(
        "LdapUserAuthenticator: LDAP base DN property [" + LDAP_BASEDN_NAME
            + "] not specified");
  }
  String sslStr = securityProps.getProperty(LDAP_SSL_NAME);
  if (sslStr != null && sslStr.toLowerCase().equals("true")) {
    this.ldapUrlScheme = "ldaps://";
  }
  else {
    this.ldapUrlScheme = "ldap://";
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:23,代码来源:LdapUserAuthenticator.java

示例4: removeUserAuth

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public boolean removeUserAuth(Message msg, boolean keepalive)
{
  try
  {
    byte [] secureBytes = msg.getSecureBytes();
    
    secureBytes =  ((HandShake)this.handshake).decryptBytes(secureBytes);
    
    //need to decrypt it first then get connectionid
    AuthIds aIds = new AuthIds(secureBytes);
    
    long connId = aIds.getConnectionId();
    
    if (connId != this.connectionId) {
      throw new  AuthenticationFailedException("Authentication failed");
    }
    
    return this.clientUserAuths.removeUserId(aIds.getUniqueId(), keepalive);      
  }
  catch(Exception ex)
  {
    throw new  AuthenticationFailedException("Authentication failed");
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:25,代码来源:ServerConnection.java

示例5: readMessage

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
protected void readMessage(DataInputStream dis, DataOutputStream dos, byte acceptanceCode, DistributedMember member)
    throws IOException, AuthenticationRequiredException,
    AuthenticationFailedException, ServerRefusedConnectionException {

  String message = dis.readUTF();
  if (message.length() == 0 && acceptanceCode != REPLY_WAN_CREDENTIALS) {
    return; // success
  }

  switch (acceptanceCode) {
    case REPLY_EXCEPTION_AUTHENTICATION_REQUIRED:
      throw new AuthenticationRequiredException(message);
    case REPLY_EXCEPTION_AUTHENTICATION_FAILED:
      throw new AuthenticationFailedException(message);
    case REPLY_EXCEPTION_DUPLICATE_DURABLE_CLIENT:
      throw new ServerRefusedConnectionException(member,
          message);
    case REPLY_WAN_CREDENTIALS:
      checkIfAuthenticWanSite(dis, dos, member);
      break;
    default:
      throw new ServerRefusedConnectionException(member,
          message);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:26,代码来源:HandShake.java

示例6: getCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public Properties getCredentials(Properties props, DistributedMember server,
    boolean isPeer) throws AuthenticationFailedException {

  Properties newProps = super.getCredentials(props, server, isPeer);
  String extraProps = props.getProperty(EXTRA_PROPS);
  if(extraProps != null) {
  	for(Iterator it = props.keySet().iterator(); it.hasNext();) {
  		String key = (String)it.next();
  		if( key.startsWith(SECURITY_PREFIX) && 
  		    key.equalsIgnoreCase(USER_NAME) == false &&
  		    key.equalsIgnoreCase(PASSWORD) == false &&
  		    key.equalsIgnoreCase(EXTRA_PROPS) == false) {
  			newProps.setProperty(key, props.getProperty(key));
  		}
  	}
  	this.securitylog.fine("got everything and now have: "
        + newProps.keySet().toString());
  }
  return newProps;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:UserPasswordWithExtraPropsAuthInit.java

示例7: performOpToTestCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public static void performOpToTestCredentials() {
  Region region = RegionHelper.getRegion(REGION_NAME);
  try {
    region.get("A_KEY");
    throw new TestException("Expected this to throw CacheWriterException");
  }
  catch (Exception ex) {
    if ((ex instanceof CacheWriterException
        || ex instanceof ServerConnectivityException || ex instanceof CacheLoaderException)
        && (ex.getCause() instanceof AuthenticationFailedException)) {
      Log.getLogWriter().info(
          "Got expected CacheWriterException: " + ex.getMessage());
    }
    else {
      throw new TestException("Exception while performOpToTestCredentials :"
          + ex.getMessage(), ex);
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:20,代码来源:SecurityTest.java

示例8: getCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
@Override
public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer) throws AuthenticationFailedException {

	String username = props.getProperty(USERNAME);
	if (username == null) {
		throw new AuthenticationFailedException("UserAuthInitialize: username not set.");
	}

	String password = props.getProperty(PASSWORD);
	if (password == null) {
		throw new AuthenticationFailedException("UserAuthInitialize: password not set.");
	}

	Properties properties = new Properties();
	properties.setProperty(USERNAME, username);
	properties.setProperty(PASSWORD, password);
	return properties;
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:gemfire,代码行数:19,代码来源:GemfireSecurityProperties.java

示例9: getCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public Properties getCredentials(Properties props, DistributedMember server,
    boolean isPeer) throws AuthenticationFailedException {

  Properties newProps = new Properties();
  String userName = props.getProperty(USER_NAME);
  if (userName == null) {
    throw new AuthenticationFailedException(
        "UserPasswordAuthInit: user name property [" + USER_NAME
            + "] not set.");
  }
  newProps.setProperty(USER_NAME, userName);
  
  String passwd = props.getProperty(PASSWORD);
  // If password is not provided then use empty string as the password.
  if (passwd == null) {
    passwd = "";
  }
  newProps.setProperty(PASSWORD, passwd);
  return newProps;
}
 
开发者ID:Pivotal-Open-Source-Hub,项目名称:geode-security-samples,代码行数:21,代码来源:UserPasswordAuthInit.java

示例10: getCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer) throws AuthenticationFailedException {

		Properties newProps = new Properties();
		String userName = props.getProperty(USER_NAME);
		if (userName == null) {
			throw new AuthenticationFailedException("UserPasswordAuthInit: user name property [" + USER_NAME + "] not set.");
		}
		newProps.setProperty(USER_NAME, userName);
		String passwd = props.getProperty(PASSWORD);
		// If password is not provided then use empty string as the password.
		if (passwd == null) {
			passwd = "";
		}
		newProps.setProperty(PASSWORD, passwd);
		return newProps;
	}
 
开发者ID:pivotal-cf,项目名称:spring-cloud-gemfire-connector,代码行数:17,代码来源:UserAuthInitialize.java

示例11: init

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
/**
 * {@link AuthInitialize#init(LogWriter, LogWriter)}
 */
@Override
public void init(LogWriter systemLogger, LogWriter securityLogger)
    throws AuthenticationFailedException {
  if(this.securitylogger == null) {
    this.securitylogger = securityLogger.convertToLogWriterI18n();
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:11,代码来源:AuthenticationServiceBase.java

示例12: authenticate

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public Principal authenticate(Properties props, DistributedMember member) {

    String userName = props.getProperty(UserPasswordAuthInit.USER_NAME);
    if (userName == null) {
      throw new AuthenticationFailedException(
          "LdapUserAuthenticator: user name property ["
              + UserPasswordAuthInit.USER_NAME + "] not provided");
    }
    String passwd = props.getProperty(UserPasswordAuthInit.PASSWORD);
    if (passwd == null) {
      passwd = "";
    }

    Properties env = new Properties();
    env
        .put(Context.INITIAL_CONTEXT_FACTORY,
            "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, this.ldapUrlScheme + this.ldapServer + '/'
        + this.basedn);
    String fullentry = "uid=" + userName + "," + this.basedn;
    env.put(Context.SECURITY_PRINCIPAL, fullentry);
    env.put(Context.SECURITY_CREDENTIALS, passwd);
    try {
      DirContext ctx = new InitialDirContext(env);
      ctx.close();
    }
    catch (Exception e) {
      //TODO:hitesh need to add getCause message
      throw new AuthenticationFailedException(
          "LdapUserAuthenticator: Failure with provided username, password "
              + "combination for user name: " + userName);
    }
    return new UsernamePrincipal(userName);
  }
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:35,代码来源:LdapUserAuthenticator.java

示例13: init

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public void init(Properties systemProps, LogWriter systemLogger,
    LogWriter securityLogger) throws AuthenticationFailedException {
  this.systemlog = systemLogger;
  this.securitylog = securityLogger;
  this.pubKeyFilePath = systemProps.getProperty(PUBLIC_KEY_FILE);
  if (this.pubKeyFilePath == null) {
    throw new AuthenticationFailedException("PKCSAuthenticator: property "
        + PUBLIC_KEY_FILE + " not specified as the public key file.");
  }
  this.pubKeyPass = systemProps.getProperty(PUBLIC_KEYSTORE_PASSWORD);
  this.aliasCertificateMap = new HashMap();
  populateMap();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:PKCSAuthenticator.java

示例14: getException

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
private AuthenticationFailedException getException(String exStr,
    Exception cause) {

  String exMsg = "PKCSAuthenticator: Authentication of client failed due to: "
      + exStr;
  if (cause != null) {
    return new AuthenticationFailedException(exMsg, cause);
  }
  else {
    return new AuthenticationFailedException(exMsg);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:13,代码来源:PKCSAuthenticator.java

示例15: verifyCredentials

import com.gemstone.gemfire.security.AuthenticationFailedException; //导入依赖的package包/类
public static Principal verifyCredentials(String authenticatorMethod,
    Properties credentials, Properties securityProperties, LogWriter logger,
    LogWriter securityLogger, DistributedMember member)
    throws AuthenticationRequiredException, AuthenticationFailedException {

  Authenticator auth = null;
  try {
    if (authenticatorMethod == null || authenticatorMethod.length() == 0) {
      return null;
    }
    Method instanceGetter = ClassLoadUtil.methodFromName(authenticatorMethod);
    auth = (Authenticator)instanceGetter.invoke(null, (Object[])null);
  }
  catch (Exception ex) {
    throw new AuthenticationFailedException(
        LocalizedStrings.HandShake_FAILED_TO_ACQUIRE_AUTHENTICATOR_OBJECT.toLocalizedString(), ex);
  }
  if (auth == null) {
    throw new AuthenticationFailedException(
      LocalizedStrings.HandShake_AUTHENTICATOR_INSTANCE_COULD_NOT_BE_OBTAINED.toLocalizedString()); 
  }
  auth.init(securityProperties, logger, securityLogger);
  Principal principal;
  try {
    principal = auth.authenticate(credentials, member);
  }
  finally {
    auth.close();
  }
  return principal;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:32,代码来源:HandShake.java


注:本文中的com.gemstone.gemfire.security.AuthenticationFailedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。