Package org.apache.isis.core.commons.authentication

Examples of org.apache.isis.core.commons.authentication.AuthenticationSession


    // security
    // //////////////////////////////////////////////////////////////////

    @Override
    public UserMemento getUser() {
        final AuthenticationSession session = getAuthenticationSessionProvider().getAuthenticationSession();

        final String name = session.getUserName();
        final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());

        final UserMemento user = new UserMemento(name, roleMementos);
        return user;
    }
View Full Code Here


        super(type(), holder, false);
    }

    @Override
    public String disables(final UsabilityContext<? extends UsabilityEvent> ic) {
        final AuthenticationSession session = ic.getSession();
        return disabledReason(session);
    }
View Full Code Here

    // /////////////////////////////////////////////////////

    public void handleRequest() throws IOException {
        final long start = System.currentTimeMillis();
        final Request request = connection.readRequest();
        AuthenticationSession authenticationSession = null;
        try {
            authenticationSession = openSessionIfNotAuthenticateRequest(request);

            monitorRequest(authenticationSession, request);
            executeRequest(request);
View Full Code Here

            calcResponseTime(start);
        }
    }

    private AuthenticationSession openSessionIfNotAuthenticateRequest(final Request request) {
        AuthenticationSession authenticationSession;
        if (LOG.isDebugEnabled()) {
            debugRequest = request.getId() + " - " + request.toString();
        }
        authenticationSession = request.getSession();

        if (authenticationSession == null) {
            if (LOG.isDebugEnabled()) {
                debugAuthSession = "(none)";
                debugContextId = "(none)";
            }

            if (!(request instanceof OpenSessionRequest)) {
                throw new IsisException("AuthenticationSession required for all requests (except the initial Authenticate request)");
            }
        } else {
            IsisContext.openSession(authenticationSession);

            if (LOG.isDebugEnabled()) {
                debugAuthSession = authenticationSession.toString();
                debugContextId = IsisContext.getSessionId();
                debugSessionInfo = IsisContext.debugSession();
            }
        }
        return authenticationSession;
View Full Code Here

    // session
    // ////////////////////////////////////////////////////////////////

    @Override
    public CloseSessionResponse closeSession(final CloseSessionRequest request) {
        final AuthenticationSession session = request.getSession();
        log("close session " + session);
        final CloseSessionResponse response = decorated.closeSession(request);
        return response;
    }
View Full Code Here

import org.apache.isis.viewer.html.request.Request;

public class LogOut implements Action {
    @Override
    public void execute(final Request request, final Context context, final Page page) {
        final AuthenticationSession authSession = IsisContext.getAuthenticationSession();
        if (authSession != null) {
            getAuthenticationManager().closeSession(authSession);
        }
        context.setSession(null); // setSession is probably redundant since now
                                  // always available via IsisContext
View Full Code Here

        }
        return instance.authenticationManager;
    }

    public static AuthenticationSession startRequest(final RequestContext context) {
        AuthenticationSession session = context.getSession();
        if (session == null) {
            session = new AnonymousSession();
            LOG.debug("start anonymous request: " + session);
        } else {
            LOG.debug("start request for: " + session.getUserName());
        }
        IsisContext.closeSession();
        IsisContext.openSession(session);
        return session;
    }
View Full Code Here

        IsisContext.openSession(session);
        return session;
    }

    public static AuthenticationSession authenticate(final AuthenticationRequestPassword passwordAuthenticationRequest) {
        final AuthenticationSession session = getAuthenticationManager().authenticate(passwordAuthenticationRequest);
        if (session != null) {
            LOG.info("log on user " + session.getUserName());
            IsisContext.closeSession();
            IsisContext.openSession(session);
        }
        return session;
    }
View Full Code Here

            // otherwise overloaded method may be incorrectly
            // selected.
            final ObjectAction action = MethodsUtils.findAction(object, methodName);
            entryState = validateParameters(context, action, object);

            final AuthenticationSession session = context.getSession();
            if (session == null && action.isVisible(new AnonymousSession(), object).isVetoed()) {
                throw new NotLoggedInException();
            }

            object.checkLock(context.getVersion(version));
View Full Code Here

        final AuthenticationManager authenticationManager = getAuthenticationManager();
        final HttpSession httpSession = getHttpSession(servletRequest);

        // use previously authenticated session if available
        AuthenticationSession authSession = (AuthenticationSession) httpSession.getAttribute(WebAppConstants.HTTP_SESSION_AUTHENTICATION_SESSION_KEY);
        if (authSession != null) {
            final boolean sessionValid = authenticationManager.isSessionValid(authSession);
            if (sessionValid) {
                return authSession;
            }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.commons.authentication.AuthenticationSession

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.