Package org.apache.openejb.client

Examples of org.apache.openejb.client.AuthenticationResponse


    public Response processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception {

        final AuthenticationRequest req = new AuthenticationRequest();
        req.setMetaData(metaData);

        final AuthenticationResponse res = new AuthenticationResponse();
        res.setMetaData(metaData);

        try {
            req.readExternal(in);

            final String securityRealm = req.getRealm();
            final String username = req.getUsername();
            final String password = req.getCredentials();

            final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
            final Object token = securityService.login(securityRealm, username, password);

            final ClientMetaData client = new ClientMetaData();
            client.setMetaData(metaData);
            client.setClientIdentity(token);

            res.setIdentity(client);
            res.setResponseCode(ResponseCodes.AUTH_GRANTED);
        } catch (Throwable t) {
            res.setResponseCode(ResponseCodes.AUTH_DENIED);
            res.setDeniedCause(t);
        } finally {
            if (debug) {
                try {
                    logger.debug("AUTH REQUEST: " + req + " -- RESPONSE: " + res);
                } catch (Exception e) {
View Full Code Here


    @Override
    public void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception {

        if (AuthenticationResponse.class.isInstance(response)) {

            final AuthenticationResponse res = (AuthenticationResponse) response;
            res.setMetaData(metaData);

            try {
                res.writeExternal(out);
            } catch (Exception e) {
                logger.fatal("Could not write AuthenticationResponse to output stream", e);
            }
        } else {
            logger.error("AuthRequestHandler cannot process an instance of: " + response.getClass().getName());
View Full Code Here

    public Response processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception {

        final AuthenticationRequest req = new AuthenticationRequest();
        req.setMetaData(metaData);

        final AuthenticationResponse res = new AuthenticationResponse();
        res.setMetaData(metaData);

        try {
            req.readExternal(in);

            final String securityRealm = req.getRealm();
            final String username = req.getUsername();
            final String password = req.getCredentials();

            final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
            final Object token = securityService.login(securityRealm, username, password);

            final ClientMetaData client = new ClientMetaData();
            client.setMetaData(metaData);
            client.setClientIdentity(token);

            res.setIdentity(client);
            res.setResponseCode(ResponseCodes.AUTH_GRANTED);
        } catch (final Throwable t) {
            res.setResponseCode(ResponseCodes.AUTH_DENIED);
            res.setDeniedCause(t);
        } finally {
            if (debug) {
                try {
                    logger.debug("AUTH REQUEST: " + req + " -- RESPONSE: " + res);
                } catch (final Exception e) {
View Full Code Here

    @Override
    public void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception {

        if (AuthenticationResponse.class.isInstance(response)) {

            final AuthenticationResponse res = (AuthenticationResponse) response;
            res.setMetaData(metaData);

            try {
                res.writeExternal(out);
            } catch (final Exception e) {
                logger.fatal("Could not write AuthenticationResponse to output stream", e);
            }
        } else {
            logger.error("AuthRequestHandler cannot process an instance of: " + response.getClass().getName());
View Full Code Here

    AuthRequestHandler(EjbDaemon daemon) {
    }

    public void processRequest(ObjectInputStream in, ObjectOutputStream out) {
        AuthenticationRequest req = new AuthenticationRequest();
        AuthenticationResponse res = new AuthenticationResponse();

        try {
            req.readExternal(in);

            String securityRealm = req.getRealm();
            String username = req.getUsername();
            String password = req.getCredentials();

            SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
            Object token = securityService.login(securityRealm, username, password);

            ClientMetaData client = new ClientMetaData();
            client.setClientIdentity(token);

            res.setIdentity(client);
            res.setResponseCode(ResponseCodes.AUTH_GRANTED);
        } catch (Throwable t) {
            res.setResponseCode(ResponseCodes.AUTH_DENIED);
            res.setDeniedCause(t);
        } finally {
            if (logger.isDebugEnabled()){
                try {
                    logger.debug("AUTH REQUEST: "+req+" -- RESPONSE: " + res);
                } catch (Exception justInCase) {}
            }

            try {
                res.writeExternal(out);
            } catch (java.io.IOException ie) {
                logger.fatal("Couldn't write AuthenticationResponse to output stream", ie);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.client.AuthenticationResponse

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.