Examples of AuthenticationSession


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

            final DebugPane debugPane = context.getComponentFactory().createDebugPane();
            page.setDebug(debugPane);

            final DebugString debug = new DebugString();

            final AuthenticationSession authenticationSession = IsisContext.getAuthenticationSession();
            debug.appendTitle("Session");
            if (authenticationSession != null) {
                debug.appendln("user", authenticationSession.getUserName());
                debug.appendln("roles", authenticationSession.getRoles());
            } else {
                debug.appendln("none");
            }

            final UserProfile userProfile = IsisContext.getUserProfile();
View Full Code Here

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

    @Override
    protected void doExecute(final Context context, final ViewPane content, final ObjectAdapter adapter, final String field) {
        final String id = context.mapObject(adapter);
        final ObjectSpecification specification = adapter.getSpecification();

        final AuthenticationSession authenticationSession = getAuthenticationSession();

        createObjectView(context, adapter, content, id);

        // // TODO: this test should be done by the ImmutableFacetFactory
        // installing an immutableFacet on every
View Full Code Here

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

    public void openSession(final String userName, final List<String> roles) {
        IsisContext.closeSession();
        final LogonFixture logonFixture = new LogonFixture(userName, roles);
        final AuthenticationRequestLogonFixture authRequest = new AuthenticationRequestLogonFixture(logonFixture);
        final AuthenticationSession authSession = getAuthenticationManager().authenticate(authRequest);

        IsisContext.openSession(authSession);
    }
View Full Code Here

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

                    request.appendHtml("Object: " + result);
                }
                request.appendHtml("</pre>");
            } else if ("session".equals(type)) {
                request.appendHtml("<pre>");
                final AuthenticationSession session = IsisContext.getAuthenticationSession();
                request.appendHtml("Session:  " + session.getUserName() + " " + session.getRoles());
                request.appendHtml("</pre>");
            } else if ("variables".equals(type)) {
                final RequestContext context = request.getContext();
                final DebugHtmlString debug = new DebugHtmlString();
                debug.appendln("", "");
View Full Code Here

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

class TestHasRole extends Test {
    @Override
    boolean test(final Request request, final String attributeName, final String targetId) {
        final String[] requiredRoles = attributeName.split("\\|");
        final AuthenticationSession session = IsisContext.getSession().getAuthenticationSession();
        final List<String> sessionRoles = session.getRoles();
        for (final String sessionRole : sessionRoles) {
            for (final String requiredRole : requiredRoles) {
                if (requiredRole.trim().equals(sessionRole)) {
                    return true;
                }
View Full Code Here

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

    private static boolean valid(final Request request, final ObjectAdapter adapter) {
        // TODO is this check valid/necessary?

        // TODO check is valid to remove element
        final AuthenticationSession session = IsisContext.getAuthenticationSession();
        final Filter<ObjectAssociation> filter = ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where);
        final List<ObjectAssociation> visibleFields = adapter.getSpecification().getAssociations(Contributed.EXCLUDED, filter);
        if (visibleFields.size() == 0) {
            return false;
        }
View Full Code Here

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

            String linkAllView = request.getOptionalProperty(LINK_VIEW);

            request.setBlockContent(tag);
            request.processUtilCloseTag();

            final AuthenticationSession session = IsisContext.getAuthenticationSession();
            List<ObjectAssociation> associations = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, Where.OBJECT_FORMS));
            final List<ObjectAssociation> fields = tag.includedFields(associations);
            final LinkedObject[] linkFields = tag.linkedFields(fields);

            if (linkAllView != null) {
View Full Code Here

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

    // for any other value for Where
    private final Where where = Where.ANYWHERE;

    @Override
    protected boolean valid(final Request request, final ObjectAdapter object) {
        final AuthenticationSession session = IsisContext.getAuthenticationSession();
        final List<ObjectAssociation> visibleFields = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, where));
        return visibleFields.size() > 0;
    }
View Full Code Here

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

    private final Where where = Where.ANYWHERE;

    @Override
    protected boolean valid(final Request request, final ObjectAdapter adapter) {
        final ObjectSpecification specification = adapter.getSpecification();
        final AuthenticationSession session = IsisContext.getAuthenticationSession();
        final List<ObjectAssociation> visibleFields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where));
        final ImmutableFacet facet = specification.getFacet(ImmutableFacet.class);
        final boolean isImmutable = facet != null && facet.when() == When.ALWAYS;
        final boolean isImmutableOncePersisted = facet != null && facet.when() == When.ONCE_PERSISTED && adapter.representsPersistent();
        return visibleFields.size() > 0 && !isImmutable && !isImmutableOncePersisted;
View Full Code Here

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

        final boolean isUsable = getSession() != null && usable.isAllowed();
        return isUsable ? null : usable.getReason();
    }

    public static boolean isVisibleAndUsable(final ObjectAdapter object, final ObjectAction action, Where where) {
        AuthenticationSession authenticatedSession = getAuthenticationSession();
        final boolean isVisible = action.isVisible(authenticatedSession, object, where).isAllowed();
        final boolean isUsable = getSession() != null && action.isUsable(authenticatedSession, object, where).isAllowed();
        final boolean isVisibleAndUsable = isVisible && isUsable;
        return isVisibleAndUsable;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.