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

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


    @Override
    protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {

        // look for existing valid session
        final AuthenticationSession existingAuthSession = authenticationSessionStrategy.lookupValid(request, response);
        if (existingAuthSession != null) {
            redirectToStartPage(response, existingAuthSession.getUserName());
            return;
        }

        // prompt
        final String user = request.getParameter("username");
        final String password = request.getParameter("password");
        if (user == null && !getDeploymentType().isExploring()) {
            renderPrompt(response, "", "", null);
            return;
        }

        // authenticate; re-prompt if required
        final AuthenticationSession authSession = authenticate(user, password);
        if (authSession == null) {
            renderPrompt(response, user, password, "user/password invalid");
            return;
        }

        // authenticated
        authenticationSessionStrategy.bind(request, response, authSession);

        final Context context = new Context(getHtmlComponentFactory());
        context.setSession(authSession);
        authSession.setAttribute(HtmlServletConstants.AUTHENTICATION_SESSION_CONTEXT_KEY, context);

        LOG.info("created session");
        redirectToStartPage(response, user);
    }
View Full Code Here


            }
        }
    }

    private Context getContextForRequest(final HttpServletRequest request) {
        final AuthenticationSession authSession = getAuthenticationSession();
        Context context = (Context) authSession.getAttribute(HtmlServletConstants.AUTHENTICATION_SESSION_CONTEXT_KEY);
        if (context == null || !context.isValid()) {
            context = new Context(getHtmlComponentFactory());
            authSession.setAttribute(HtmlServletConstants.AUTHENTICATION_SESSION_CONTEXT_KEY, context);
        }
        return context;
    }
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.invalidate();
    }
View Full Code Here

        final AuthenticatedWebSessionForIsis wicketSession = AuthenticatedWebSessionForIsis.get();
        if (wicketSession == null) {
            // FIXME Session.get() acts as getOrCreate so this will never be null
            return;
        }
        final AuthenticationSession authenticationSession = wicketSession.getAuthenticationSession();
        if (authenticationSession == null) {
            return;
        }

        getIsisContext().openSessionInstance(authenticationSession);
View Full Code Here

        return ACTION;
    }

    @Override
    public void process(final RequestContext context) throws IOException {
        AuthenticationSession session = context.getSession();
        if (session == null) {
            session = new AnonymousSession();
        }

        try {
View Full Code Here

        return ACTION;
    }

    @Override
    public void process(final RequestContext context) throws IOException {
        AuthenticationSession session = context.getSession();
        if (session == null) {
            session = new AnonymousSession();
        }

        final String parentId = context.getParameter(OBJECT);
View Full Code Here

            final ObjectAssociation association,
            final List<ObjectAction> associatedActions) {
        final ObjectAdapter adapter = entityModel.load(ConcurrencyChecking.NO_CHECK);

        final AuthenticationSessionProvider asa = (AuthenticationSessionProvider) Session.get();
        AuthenticationSession authSession = asa.getAuthenticationSession();

        final ObjectSpecification objectSpecification = entityModel.getTypeOfSpecification();
        @SuppressWarnings({ "unchecked", "deprecation" })
        Filter<ObjectAction> filter = Filters.and(
                    ObjectAction.Filters.memberOrderOf(association),
View Full Code Here

            final T objectMember, final MemberType memberType, final Intent intent) {

        final Where where = rendererContext.getWhere();

        final String memberId = objectMember.getId();
        final AuthenticationSession authenticationSession = rendererContext.getAuthenticationSession();
        if (objectMember.isVisible(authenticationSession, objectAdapter, where).isVetoed()) {
            throwNotFoundException(memberId, memberType);
        }
        if (intent.isMutate()) {
            final Consent usable = objectMember.isUsable(authenticationSession, objectAdapter, where);
View Full Code Here

            final ObjectAdapter adapter,
            final ActionType actionType,
            final List<ObjectAction> topLevelActions) {

        final ObjectSpecification adapterSpec = adapter.getSpecification();
        final AuthenticationSession authenticationSession = getAuthenticationSession();

        @SuppressWarnings({ "unchecked", "deprecation" })
        Filter<ObjectAction> filter = Filters.and(
                ObjectAction.Filters.memberOrderNotAssociationOf(adapterSpec),
                ObjectAction.Filters.dynamicallyVisible(authenticationSession, adapter, Where.ANYWHERE),
View Full Code Here

        }

        final String user = matcher.group(1);
        final String password = matcher.group(2);

        final AuthenticationSession authSession = getAuthenticationManager().authenticate(new AuthenticationRequestPassword(user, password));
        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.