Package org.jboss.errai.bus.client

Examples of org.jboss.errai.bus.client.MessageCallback


                            }

                        } else if (MessageCallback.class.isAssignableFrom(loadClass)) {
                            final Class<? extends MessageCallback> clazz = loadClass.asSubclass(MessageCallback.class);
                            if (clazz.isAnnotationPresent(Service.class)) {
                                MessageCallback svc = Guice.createInjector(new AbstractModule() {
                                    @Override
                                    protected void configure() {
                                        bind(MessageCallback.class).to(clazz);
                                        bind(MessageBus.class).toInstance(bus);
View Full Code Here


    private void init() {
        // just use the simple bus for now.  more integration options sendNowWith come...
        //bus.addGlobalListener(new BasicAuthorizationListener(authorizationAdapter, bus));

        //todo: this all needs sendNowWith be refactored at some point.
        bus.subscribe(AUTHORIZATION_SVC_SUBJECT, new MessageCallback() {
            public void callback(CommandMessage c) {
                switch (SecurityCommands.valueOf(c.getCommandType())) {
                    case WhatCredentials:
                        /**
                         * Respond with what credentials the authentication system requires.
                         */
                        //todo: we only support login/password for now


                        ConversationMessage.create(c)
                               .command(SecurityCommands.WhatCredentials)
                                .set(SecurityParts.CredentialsRequired, "Name,Password")
                                .set(SecurityParts.ReplyTo, AUTHORIZATION_SVC_SUBJECT)
                                .sendNowWith(bus);

                        break;

                    case AuthRequest:
                        /**
                         * Send a challenge.
                         */

                        configurator.getResource(AuthenticationAdapter.class)
                                .challenge(c);
                        break;

                    case EndSession:
                        configurator.getResource(AuthenticationAdapter.class)
                                .challenge(c);
                        bus.send(ConversationMessage.create(c).toSubject("LoginClient")
                                .command(SecurityCommands.SecurityChallenge));
                        break;
                }
            }
        });


        /**
         * The standard ServerEchoService.
         */
        bus.subscribe("ServerEchoService", new MessageCallback() {
            public void callback(CommandMessage c) {
                bus.send(ConversationMessage.create(c));
            }
        });

        bus.subscribe("ClientNegotiationService", new MessageCallback() {
            public void callback(CommandMessage message) {
                AuthSubject subject = (AuthSubject)
                        ((HttpSession) message.getResource("Session")).getAttribute(ErraiService.SESSION_AUTH_DATA);

                ConversationMessage reply = ConversationMessage.create(message);
View Full Code Here

    public SecurityService() {
    }

    public void doAuthentication(final AuthenticationHandler handler) {
     
        ErraiBus.get().subscribe(SUBJECT, new MessageCallback() {
            public void callback(CommandMessage msg) {
                ErraiBus.get().unsubscribeAll(SUBJECT);

                switch (SecurityCommands.valueOf(msg.getCommandType())) {
                    case WhatCredentials:
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.MessageCallback

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.