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


Java LocalClientSession.isAllowedAnonymous方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.session.LocalClientSession.isAllowedAnonymous方法的典型用法代码示例。如果您正苦于以下问题:Java LocalClientSession.isAllowedAnonymous方法的具体用法?Java LocalClientSession.isAllowedAnonymous怎么用?Java LocalClientSession.isAllowedAnonymous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.session.LocalClientSession的用法示例。


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

示例1: evaluateResponse

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
@Override
public byte[] evaluateResponse( byte[] response ) throws SaslException
{
    if ( isComplete() )
    {
        throw new IllegalStateException( "Authentication exchange already completed." );
    }

    complete = true;

    // Verify server-wide policy.
    if ( !JiveGlobals.getBooleanProperty( "xmpp.auth.anonymous" ) )
    {
        throw new SaslException( "Authentication failed" );
    }

    // Verify that client can connect from his IP address.
    final boolean forbidAccess = !LocalClientSession.isAllowedAnonymous( session.getConnection() );
    if ( forbidAccess )
    {
        throw new SaslException( "Authentication failed" );
    }

    // Just accept the authentication :)
    return null;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:AnonymousSaslServer.java

示例2: anonymousLogin

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
private IQ anonymousLogin(LocalClientSession session, IQ packet) {
    IQ response = IQ.createResultIQ(packet);
    if (JiveGlobals.getBooleanProperty("xmpp.auth.anonymous")) {
        // Verify that client can connect from his IP address
        boolean forbidAccess = !LocalClientSession.isAllowedAnonymous( session.getConnection() );
        if (forbidAccess) {
            // Connection forbidden from that IP address
            response.setChildElement(packet.getChildElement().createCopy());
            response.setError(PacketError.Condition.forbidden);
        }
        else {
            // Anonymous authentication allowed
            session.setAnonymousAuth();
            response.setTo(session.getAddress());
            Element auth = response.setChildElement("query", "jabber:iq:auth");
            auth.addElement("resource").setText(session.getAddress().getResource());
        }
    }
    else {
        // Anonymous authentication is not allowed
        response.setChildElement(packet.getChildElement().createCopy());
        response.setError(PacketError.Condition.forbidden);
    }
    return response;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:IQAuthHandler.java


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