Examples of IdentityToken


Examples of org.apache.jetspeed.security.activeauthentication.IdentityToken

        if (authenticationConfiguration.isCreateNewSessionOnLogin())
        {
   
            ActiveAuthenticationIdentityProvider identityProvider = (ActiveAuthenticationIdentityProvider)
                Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.activeauthentication.ActiveAuthenticationIdentityProvider");
            IdentityToken token = identityProvider.createIdentityToken(username);
            saveState(session, token, identityProvider.getSessionAttributeNames());
            request.getSession().invalidate();
            HttpSession newSession = request.getSession(true);
            restoreState(newSession, token);
            response.sendRedirect(response.encodeURL(request.getContextPath()
                    + "/login/redirector?token=") + token.getToken());
           
        }
        else
        {
            response.sendRedirect(response.encodeURL(request.getContextPath()
View Full Code Here

Examples of org.apache.jetspeed.security.activeauthentication.IdentityToken

        if (!portalFiltered && authenticationConfiguration.isCreateNewSessionOnLogin())
        {
   
            ActiveAuthenticationIdentityProvider identityProvider = (ActiveAuthenticationIdentityProvider)
                Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.activeauthentication.ActiveAuthenticationIdentityProvider");
            IdentityToken token = identityProvider.createIdentityToken(username);
            saveState(session, token, identityProvider.getSessionAttributeNames());
            request.getSession().invalidate();
            HttpSession newSession = request.getSession(true);
            restoreState(newSession, token);
            response.sendRedirect(response.encodeURL(request.getContextPath()
                    + "/login/redirector?token=") + token.getToken());
           
        }
        else
        {
            response.sendRedirect(response.encodeURL(request.getContextPath()
View Full Code Here

Examples of org.apache.jetspeed.security.activeauthentication.IdentityToken

        if (!portalFiltered && authenticationConfiguration.isCreateNewSessionOnLogin())
        {
   
            ActiveAuthenticationIdentityProvider identityProvider = (ActiveAuthenticationIdentityProvider)
                Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.activeauthentication.ActiveAuthenticationIdentityProvider");
            IdentityToken token = identityProvider.createIdentityToken(username);
            saveState(session, token, identityProvider.getSessionAttributeNames());
            request.getSession().invalidate();
            HttpSession newSession = request.getSession(true);
            restoreState(newSession, token);
            response.sendRedirect(response.encodeURL(request.getContextPath()
                    + "/login/redirector?token=") + token.getToken());
           
        }
        else
        {
            response.sendRedirect(response.encodeURL(request.getContextPath()
View Full Code Here

Examples of org.omg.CSI.IdentityToken

                encoding = Util.getCodec().encode_value(any);
            } catch (InvalidTypeForEncoding itfe) {
                throw new IllegalStateException("Unable to encode principal name '" + name + "' " + itfe);
            }

            token = new IdentityToken();
            token.principal_name(encoding);
        }
        return token;
    }
View Full Code Here

Examples of org.omg.CSI.IdentityToken

     * TODO should also use login domains?
     * @return IdentityToken
     */
    public IdentityToken encodeIdentityToken() {

        IdentityToken token = null;
        Subject subject = ContextManager.getNextCaller();
        String principalName = null;
        if (subject == null) {
//            Set principals = Collections.EMPTY_SET;
        } else if (realm != null) {
            Set principals = subject.getPrincipals(RealmPrincipal.class);
            for (Iterator iter = principals.iterator(); iter.hasNext();) {
                RealmPrincipal p = (RealmPrincipal) iter.next();
                if (p.getRealm().equals(realm) && p.getLoginDomain().equals(domain) && p.getPrincipal().getClass().equals(principalClass)) {
                    principalName = p.getPrincipal().getName();
                    if (p instanceof PrimaryRealmPrincipal) break;
                }
            }
        } else if (domain != null) {
            Set principals = subject.getPrincipals(DomainPrincipal.class);
            for (Iterator iter = principals.iterator(); iter.hasNext();) {
                DomainPrincipal p = (DomainPrincipal) iter.next();
                if (p.getDomain().equals(domain) && p.getPrincipal().getClass().equals(principalClass)) {
                    principalName = p.getPrincipal().getName();
                    if (p instanceof PrimaryDomainPrincipal) break;
                }
            }
        } else {
            Set principals = subject.getPrincipals(principalClass);
            if (!principals.isEmpty()) {
                Principal principal = (Principal) principals.iterator().next();
                principalName = principal.getName();

            }
        }

        if (principalName != null) {

            Any any = Util.getORB().create_any();

            //TODO consider including a domain in this scoped-username
            GSS_NT_ExportedNameHelper.insert(any, Util.encodeGSSExportName(oid, principalName));

            byte[] encoding = null;
            try {
                encoding = Util.getCodec().encode_value(any);
            } catch (InvalidTypeForEncoding itfe) {
                throw new IllegalStateException("Unable to encode principal name '" + principalName + "' " + itfe);
            }

            token = new IdentityToken();
            token.principal_name(encoding);
        } else {
            token = new IdentityToken();
            token.anonymous(true);
        }

        return token;
    }
View Full Code Here

Examples of org.omg.CSI.IdentityToken

                CSIv2Util.toString(secMech, tmp);
                JacORBLogger.ROOT_LOGGER.trace(tmp);
            }

            // these "null tokens" will be changed if needed.
            IdentityToken identityToken = absentIdentityToken;
            byte[] encodedAuthenticationToken = noAuthenticationToken;

            if ((secMech.sas_context_mech.target_supports & IdentityAssertion.value) != 0) {
                // will create identity token.
                RunAs runAs = SecurityContextAssociation.peekRunAsIdentity();
                Principal p = (runAs != null) ? runAs : SecurityContextAssociation.getPrincipal();

                if (p != null) {
                    // The name scope needs to be externalized.
                    String name = p.getName();
                    if (name.indexOf('@') < 0) {
                        name += "@default"; // hardcoded (REVISIT!)
                    }
                    byte[] principalName = name.getBytes("UTF-8");

                    // encode the principal name as mandated by RFC2743.
                    byte[] encodedName = CSIv2Util.encodeGssExportedName(principalName);

                    // encapsulate the encoded name.
                    Any any = ORB.init().create_any();
                    byte[] encapsulatedEncodedName;
                    GSS_NT_ExportedNameHelper.insert(any, encodedName);
                    try {
                        encapsulatedEncodedName = codec.encode_value(any);
                    } catch (InvalidTypeForEncoding e) {
                        throw JacORBMessages.MESSAGES.unexpectedException(e);
                    }

                    // create identity token.
                    identityToken = new IdentityToken();
                    identityToken.principal_name(encapsulatedEncodedName);
                } else if ((secMech.sas_context_mech.supported_identity_types & ITTAnonymous.value) != 0) {
                    // no run-as or caller identity and the target supports ITTAnonymous: use the anonymous identity.
                    identityToken = new IdentityToken();
                    identityToken.anonymous(true);
                }
            }

            if ((secMech.as_context_mech.target_requires & EstablishTrustInClient.value) != 0) {
                // will create authentication token with the configured pair serverUsername/serverPassword.
View Full Code Here

Examples of org.omg.CSI.IdentityToken

        try
        {
            Any msg = null;
            if (client_context_id <= 0)
            {
                IdentityToken identityToken = new IdentityToken();
                identityToken.absent(true);
                contextToken = sasContext.createClientContext(orb, codec, csmList);
                msg = makeEstablishContext(orb,
                                           -client_context_id,
                                           authorizationList,
                                           identityToken,
View Full Code Here

Examples of org.omg.CSI.IdentityToken

                CSIv2Util.toString(secMech, tmp);
                JacORBLogger.ROOT_LOGGER.trace(tmp);
            }

            // these "null tokens" will be changed if needed.
            IdentityToken identityToken = absentIdentityToken;
            byte[] encodedAuthenticationToken = noAuthenticationToken;

            if ((secMech.sas_context_mech.target_supports & IdentityAssertion.value) != 0) {
                // will create identity token.
                RunAs runAs = SecurityActions.peekRunAsIdentity();
                Principal p = (runAs != null) ? runAs : SecurityActions.getPrincipal();

                if (p != null) {
                    // The name scope needs to be externalized.
                    String name = p.getName();
                    if (name.indexOf('@') < 0) {
                        name += "@default"; // hardcoded (REVISIT!)
                    }
                    byte[] principalName = name.getBytes(StandardCharsets.UTF_8);

                    // encode the principal name as mandated by RFC2743.
                    byte[] encodedName = CSIv2Util.encodeGssExportedName(principalName);

                    // encapsulate the encoded name.
                    Any any = ORB.init().create_any();
                    byte[] encapsulatedEncodedName;
                    GSS_NT_ExportedNameHelper.insert(any, encodedName);
                    try {
                        encapsulatedEncodedName = codec.encode_value(any);
                    } catch (InvalidTypeForEncoding e) {
                        throw JacORBLogger.ROOT_LOGGER.unexpectedException(e);
                    }

                    // create identity token.
                    identityToken = new IdentityToken();
                    identityToken.principal_name(encapsulatedEncodedName);
                } else if ((secMech.sas_context_mech.supported_identity_types & ITTAnonymous.value) != 0) {
                    // no run-as or caller identity and the target supports ITTAnonymous: use the anonymous identity.
                    identityToken = new IdentityToken();
                    identityToken.anonymous(true);
                }
            }

            if ((secMech.as_context_mech.target_requires & EstablishTrustInClient.value) != 0) {
                // will create authentication token with the configured pair serverUsername/serverPassword.
View Full Code Here

Examples of org.omg.CSI.IdentityToken

                CSIv2Util.toString(secMech, tmp);
                log.trace(tmp);
            }

            // these "null tokens" will be changed if needed.
            IdentityToken identityToken = absentIdentityToken;
            byte[] encodedAuthenticationToken = noAuthenticationToken;

            if ((secMech.sas_context_mech.target_supports & IdentityAssertion.value) != 0) {
                // will create identity token.
                RunAs runAs = SecurityContextAssociation.peekRunAsIdentity();
                Principal p = (runAs != null) ? runAs : SecurityContextAssociation.getPrincipal();

                if (p != null) {
                    // The name scope needs to be externalized.
                    String name = p.getName();
                    if (name.indexOf('@') < 0) {
                        name += "@default"; // hardcoded (REVISIT!)
                    }
                    byte[] principalName = name.getBytes("UTF-8");

                    // encode the principal name as mandated by RFC2743.
                    byte[] encodedName = CSIv2Util.encodeGssExportedName(principalName);

                    // encapsulate the encoded name.
                    Any any = ORB.init().create_any();
                    byte[] encapsulatedEncodedName;
                    GSS_NT_ExportedNameHelper.insert(any, encodedName);
                    try {
                        encapsulatedEncodedName = codec.encode_value(any);
                    } catch (InvalidTypeForEncoding e) {
                        throw new RuntimeException("Unexpected exception: " + e);
                    }

                    // create identity token.
                    identityToken = new IdentityToken();
                    identityToken.principal_name(encapsulatedEncodedName);
                } else if ((secMech.sas_context_mech.supported_identity_types & ITTAnonymous.value) != 0) {
                    // no run-as or caller identity and the target supports ITTAnonymous: use the anonymous identity.
                    identityToken = new IdentityToken();
                    identityToken.anonymous(true);
                }
            }

            if ((secMech.as_context_mech.target_requires & EstablishTrustInClient.value) != 0) {
                // will create authentication token with the configured pair serverUsername/serverPassword.
View Full Code Here

Examples of org.omg.CSI.IdentityToken

        try
        {
            Any msg = null;
            if (client_context_id <= 0)
            {
                IdentityToken identityToken = new IdentityToken();
                identityToken.absent(true);
                contextToken = sasContext.createClientContext(orb, codec, csmList);
                msg = makeEstablishContext(orb,
                                           -client_context_id,
                                           authorizationList,
                                           identityToken,
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.