• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InternalUnauthenticatedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setPassword

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
/**
 * Sets a new password for this user.
 *
 * @param password the new password for the user.
 * @throws UnsupportedOperationException exception
 */
public void setPassword(String password) throws UnsupportedOperationException {
    if (UserManager.getUserProvider().isReadOnly()) {
        throw new UnsupportedOperationException("User provider is read-only.");
    }

    try {
        AuthFactory.setPassword(username, password);

        // Fire event.
        Map<String,Object> params = new HashMap<>();
        params.put("type", "passwordModified");
        UserEventDispatcher.dispatchEvent(this, UserEventDispatcher.EventType.user_modified,
                params);
    }
    catch (UserNotFoundException | ConnectionException | InternalUnauthenticatedException e) {
        Log.error(e.getMessage(), e);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:25,代码来源:User.java


示例2: authenticate

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
public void authenticate(String userName, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException {
	if (auditPlugin == null) {
		auditPlugin = (AuditPlugin)(XMPPServer.getInstance().getPluginManager().getPlugin(JiveProperties.getInstance().get(AUDIT_PLUGIN_PROPERTY_NAME)));
	}

       boolean doAudit = false;
       if (auditPlugin == null && !hasWarnedNoAuditing) {
           System.out.println("SuperuserAuthProvider.authenticate() Warning: audit plugin not found.");

           hasWarnedNoAuditing = true;
       } else {
           doAudit = JiveProperties.getInstance().getBooleanProperty("com.surevine.chat.openfire.auth.logSuperuserLogins");
       }

       if (!password.equals(JiveProperties.getInstance().get(PASSWORD_PROPERTY))) {
   		if (doAudit) {
               auditPlugin.getAuditMessageFactory().createAuditMessageForSULogin(userName, false);
           }

   		throw new UnauthorizedException("The super user provided an incorrect password");
   	}

       if (doAudit) {
   		auditPlugin.getAuditMessageFactory().createAuditMessageForSULogin(userName, true);
       }
}
 
开发者ID:surevine,项目名称:openfire-superuser-auth-provider,代码行数:27,代码来源:SuperuserAuthProvider.java


示例3: authenticate

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
/**
 * Returns if the username and password are valid; otherwise this
 * method throws an UnauthorizedException.<p>
 *
 * @param username the username or full JID.
 * @param password the password
 * @throws UnauthorizedException if the username and password do
 *      not match any existing user.
 * @throws ConnectionException it there is a problem connecting to user and group sytem
 * @throws InternalUnauthenticatedException if there is a problem authentication Openfire itself into the user and group system
 */
@Override
public void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException {
    if (manager == null) {
        throw new ConnectionException("Unable to connect to Crowd");
    }

    if (username == null || password == null || "".equals(password.trim())) {
        throw new UnauthorizedException();
    }

    if (username.contains("@")) {
        // Check that the specified domain matches the server's domain
        int index = username.indexOf("@");
        String domain = username.substring(index + 1);
        if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
            username = username.substring(0, index);
        } else {
            // Unknown domain. Return authentication failed.
            throw new UnauthorizedException();
        }
    }

    try {
        manager.authenticate(username, password);
    } catch (RemoteException re) {
        throw new UnauthorizedException();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:40,代码来源:CrowdAuthProvider.java


示例4: authenticate

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
/**
 * Authenticates a user with a username, token, and digest and returns an AuthToken.
 * The digest should be generated using the {@link AuthFactory#createDigest(String, String)} method.
 * If the username and digest do not match the record of any user in the system, the
 * method throws an UnauthorizedException.
 *
 * @param username the username.
 * @param token the token that was used with plain-text password to generate the digest.
 * @param digest the digest generated from plain-text password and unique token.
 * @return an AuthToken token if the username and digest are correct for the user's
 *      password and given token.
 * @throws UnauthorizedException if the username and password do not match any
 *      existing user or the account is locked out.
 */
public static AuthToken authenticate(String username, String token, String digest)
        throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException {
    if (username == null || token == null || digest == null) {
        throw new UnauthorizedException();
    }
    if ( LockOutManager.getInstance().isAccountDisabled(username)) {
        LockOutManager.getInstance().recordFailedLogin(username);
        throw new UnauthorizedException();
    }
    username = username.trim().toLowerCase();
    if (username.contains("@")) {
        // Check that the specified domain matches the server's domain
        int index = username.indexOf("@");
        String domain = username.substring(index + 1);
        if (domain.equals( XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
            username = username.substring(0, index);
        } else {
            // Unknown domain. Return authentication failed.
            throw new UnauthorizedException();
        }
    }
    try {
        String password = AuthFactory.getPassword( username );
        String anticipatedDigest = AuthFactory.createDigest(token, password);
        if (!digest.equalsIgnoreCase(anticipatedDigest)) {
            throw new UnauthorizedException();
        }
    }
    catch (UserNotFoundException unfe) {
        throw new UnauthorizedException();
    }
    // Got this far, so the user must be authorized.
    return new AuthToken(username);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:49,代码来源:IQAuthHandler.java


示例5: authenticate

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
/**
    * Returns if the username and password are valid; otherwise this
    * method throws an UnauthorizedException.<p>
    *
    * If {@link #isPlainSupported()} returns false, this method should
    * throw an UnsupportedOperationException.
    *
    * @param username the username or full JID.
    * @param password the password
    * @throws UnauthorizedException if the username and password do
    *      not match any existing user.
    * @throws ConnectionException it there is a problem connecting to user and group sytem
    * @throws InternalUnauthenticatedException if there is a problem authentication Openfire itself into the user and group system
    */
public void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException {
	if (manager == null) {
		throw new ConnectionException("Unable to connect to Crowd");
	}

       if (username == null || password == null || "".equals(password.trim())) {
           throw new UnauthorizedException();
       }

       if (username.contains("@")) {
           // Check that the specified domain matches the server's domain
           int index = username.indexOf("@");
           String domain = username.substring(index + 1);
           if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
               username = username.substring(0, index);
           } else {
               // Unknown domain. Return authentication failed.
               throw new UnauthorizedException();
           }
       }

       try {
		manager.authenticate(username, password);
	} catch (RemoteException re) {
		throw new UnauthorizedException();
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:42,代码来源:CrowdAuthProvider.java


示例6: testAuthenticateStringStringFailure

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
@Test(expected = UnauthorizedException.class)
public void testAuthenticateStringStringFailure()
		throws UnauthorizedException, ConnectionException,
		InternalUnauthenticatedException {
	authProvider.authenticate(AUTH_FAILURE_USERNAME, AUTH_FAILURE_PASSWORD);
}
 
开发者ID:surevine,项目名称:openfire-cas-auth-provider,代码行数:7,代码来源:CASAuthProviderTest.java


示例7: authenticate

import org.jivesoftware.openfire.auth.InternalUnauthenticatedException; //导入依赖的package包/类
/**
 * Returns if the username and password are valid; otherwise this method
 * throws an <code>UnauthorizedException</code>.
 * <p>
 * <p/>
 * If {@link #isPlainSupported()} returns false, this method should throw an
 * <code>UnsupportedOperationException</code>.
 * 
 * @param username
 *            The username or full JID.
 * @param password
 *            The password.
 * @throws org.jivesoftware.openfire.auth.UnauthorizedException
 *             If the username and password do not match any existing user.
 * @throws org.jivesoftware.openfire.auth.ConnectionException
 *             If Openfire is not able to connect to the user and group
 *             system.
 * @throws org.jivesoftware.openfire.auth.InternalUnauthenticatedException
 *             If Openfire is not able to authenticate itself into the user
 *             and group system.
 */
public void authenticate(final String username, final String password)
		throws UnauthorizedException, ConnectionException,
		InternalUnauthenticatedException {
	if (ticketValidator == null) {
		throw new ConnectionException();
	}

	// Connect to CAS and validate the proxy ticket.
	// The password field contains the CAS proxy ticket.
	ticketValidator.authenticateCASProxyTicket(username, password);
}
 
开发者ID:surevine,项目名称:openfire-cas-auth-provider,代码行数:33,代码来源:CASAuthProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StackWindow类代码示例发布时间:2022-05-23
下一篇:
Java MySQLTransientException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap