Package org.apache.sling.replication.transport.authentication

Examples of org.apache.sling.replication.transport.authentication.TransportAuthenticationException


    public Object authenticate(Object authenticable, TransportAuthenticationContext context) throws TransportAuthenticationException {

        ReplicationEndpoint endpoint = context.getAttribute("endpoint", ReplicationEndpoint.class);

        if (endpoint == null) {
            throw new TransportAuthenticationException("the endpoint to authenticate is missing from the context");
        }

        if (authenticable instanceof Executor) {
            Executor executor = (Executor) authenticable;
View Full Code Here


            throws TransportAuthenticationException {
        String path = context.getAttribute("path", String.class);
        String privilege = context.getAttribute("privilege", String.class);

        if (path == null) {
            throw new TransportAuthenticationException(
                    "the path to authenticate is missing from the context");
        }

        Session session = null;
        try {
            session = authenticable.loginService(serviceName, null);

            if (session == null) {
                throw new TransportAuthenticationException("failed to authenticate" + path);
            }
            if (!session.hasPermission(path, privilege)) {
                session.logout();
                throw new TransportAuthenticationException("failed to access path " + path + " with privilege " + privilege);
            }

            log.info("authenticated path {} with privilege {}", path, privilege);
            return session;
        } catch (RepositoryException re) {
            if (session != null) {
                session.logout();
            }
            throw new TransportAuthenticationException(re);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.replication.transport.authentication.TransportAuthenticationException

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.