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