Package org.cometd.server

Examples of org.cometd.server.DefaultSecurityPolicy


    @Test
    public void testHandshakeDenied() throws Exception
    {
        BayeuxClient client = newBayeuxClient();
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canHandshake(BayeuxServer server, ServerSession session, ServerMessage message)
            {
                return false;
View Full Code Here


    @Test
    public void testHandshakeDenied() throws Exception
    {
        BayeuxClient client = newBayeuxClient();
        SecurityPolicy oldPolicy = bayeux.getSecurityPolicy();
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canHandshake(BayeuxServer server, ServerSession session, ServerMessage message)
            {
                return false;
View Full Code Here

        demo.setInitOrder(3);

        server.start();

        BayeuxServer bayeux = cometdServlet.getBayeux();
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy());

        // Demo lazy messages
        if (Boolean.getBoolean("LAZY"))
        {
            bayeux.addExtension(new BayeuxServer.Extension.Adapter()
View Full Code Here

    @Test
    public void testSubscriptionDeniedRemovesListener() throws Exception
    {
        final AtomicBoolean subscriptionAllowed = new AtomicBoolean(false);
        evaluateScript("var subscriptionAllowed = false;");
        bayeuxServer.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canSubscribe(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
            {
                return subscriptionAllowed.get();
View Full Code Here

    public void testSubscriptionDeniedInvokesCallback() throws Exception
    {
        defineClass(Latch.class);

        final String channelName = "/foo";
        bayeuxServer.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canSubscribe(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
            {
                if (channelName.equals(channel.getId()))
View Full Code Here

    @Test
    public void testHandshakeCallbackIsInvokedOnReHandshake() throws Exception
    {
        final AtomicBoolean canHandshake = new AtomicBoolean();
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canHandshake(BayeuxServer server, ServerSession session, ServerMessage message)
            {
                if (canHandshake.compareAndSet(false, true))
View Full Code Here

    @Test
    public void testSubscriptionDeniedInvokesCallback() throws Exception
    {
        final String channelName = "/bar";
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canSubscribe(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
            {
                return !channel.getId().equals(channelName);
View Full Code Here

    }

    @Test
    public void testPublishNotAllowedInvokesCallback() throws Exception
    {
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canPublish(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
            {
                return false;
View Full Code Here

    }

    @Test
    public void testPublishFailedInvokesCallback() throws Exception
    {
        bayeux.setSecurityPolicy(new DefaultSecurityPolicy()
        {
            @Override
            public boolean canHandshake(BayeuxServer server, ServerSession session, ServerMessage message)
            {
                return false;
View Full Code Here

TOP

Related Classes of org.cometd.server.DefaultSecurityPolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.