Package org.apache.geronimo.corba.security

Examples of org.apache.geronimo.corba.security.SASException


            return subject;
        } catch (SSLPeerUnverifiedException e) {
            if ((requires & EstablishTrustInClient.value) != 0) {
                if (log.isDebugEnabled()) log.debug("Unverified peer, throwing exception");
                throw new SASException(1);
            }
            if (log.isDebugEnabled()) log.debug("Unverified peer, returning null");
            return null;
        }
    }
View Full Code Here


        try {
            if (msg.client_authentication_token != null && msg.client_authentication_token.length > 0) {
                InitialContextToken token = new InitialContextToken();

                if (!Util.decodeGSSUPToken(Util.getCodec(), msg.client_authentication_token, token))
                    throw new SASException(2);

                if (token.target_name == null) return null;

                String tokenTargetName = (token.target_name == null ? targetName : new String(token.target_name, "UTF8"));

                if (!targetName.equals(tokenTargetName)) throw new SASException(2);
                String userName = Util.extractUserNameFromScopedName(token.username);

                LoginContext context = new LoginContext(tokenTargetName,
                        new UsernamePasswordCallback(userName,
                                new String(token.password, "UTF8").toCharArray()));
                context.login();
                result = ContextManager.getServerSideSubject(context.getSubject());
            }
        } catch (UnsupportedEncodingException e) {
            throw new SASException(1, e);
        } catch (LoginException e) {
            throw new SASException(1, e);
        }


        return result;
    }
View Full Code Here

            return subject;
        } catch (SSLPeerUnverifiedException e) {
            if ((requires & EstablishTrustInClient.value) != 0) {
                if (log.isDebugEnabled()) log.debug("Unverified peer, throwing exception");
                throw new SASException(1, e);
            }
            if (log.isDebugEnabled()) log.debug("Unverified peer, returning null");
            return null;
        }
    }
View Full Code Here

        byte[] principalNameToken = identityToken.principal_name();
        Any any = null;
        try {
            any = Util.getCodec().decode_value(principalNameToken, GSS_NT_ExportedNameHelper.type());
        } catch (FormatMismatch formatMismatch) {
            throw new SASException(1, formatMismatch);
        } catch (TypeMismatch typeMismatch) {
            throw new SASException(1, typeMismatch);
        }
        byte[] principalNameBytes = GSS_NT_ExportedNameHelper.extract(any);
        String principalName = Util.decodeGSSExportName(principalNameBytes);
        principalName = Util.extractUserNameFromScopedName(principalName);
        Principal basePrincipal = null;
        try {
            getConstructor();
            basePrincipal = (Principal) constructor.newInstance(new Object[]{principalName});
        } catch (InstantiationException e) {
            throw new SASException(1, e);
        } catch (IllegalAccessException e) {
            throw new SASException(1, e);
        } catch (InvocationTargetException e) {
            throw new SASException(1, e);
        } catch (NoSuchMethodException e) {
            throw new SASException(1, e);
        }

        Subject subject = new Subject();
        subject.getPrincipals().add(basePrincipal);
        if (realmName != null && domainName != null) {
View Full Code Here

            return subject;
        } catch (SSLPeerUnverifiedException e) {
            if ((requires & EstablishTrustInClient.value) != 0) {
                if (log.isDebugEnabled()) log.debug("Unverified peer, throwing exception");
                throw new SASException(1, e);
            }
            if (log.isDebugEnabled()) log.debug("Unverified peer, returning null");
            return null;
        }
    }
View Full Code Here

    public String getOID() {
        return OID;
    }

    public Subject check(IdentityToken identityToken) throws SASException {
        throw new SASException(1, new Exception("NYI -- cert chain identity token"));
    }
View Full Code Here

        if (msg.identity_token != null) {
            IdentityToken identityToken = msg.identity_token;
            int discriminator = identityToken.discriminator();
            TSSSASIdentityToken tssIdentityToken = (TSSSASIdentityToken) idTokens.get(new Integer(discriminator));
            if (tssIdentityToken == null) {
                throw new SASException(1, new Exception("Unsupported IdentityTokenType: " + discriminator));
            } else {
                return tssIdentityToken.check(identityToken);
            }
        } else {
            return null;
View Full Code Here

        try {
            if (msg.client_authentication_token != null && msg.client_authentication_token.length > 0) {
                InitialContextToken token = new InitialContextToken();

                if (!Util.decodeGSSUPToken(Util.getCodec(), msg.client_authentication_token, token))
                    throw new SASException(2);

                if (token.target_name == null) return null;

                String tokenTargetName = (token.target_name == null ? targetName : new String(token.target_name, "UTF8"));

                if (!targetName.equals(tokenTargetName)) throw new SASException(2);
                String userName = Util.extractUserNameFromScopedName(token.username);

                LoginContext context = ContextManager.login(tokenTargetName,
                        new UsernamePasswordCallback(userName,
                                new String(token.password, "UTF8").toCharArray()));
                result = context.getSubject();
            }
        } catch (UnsupportedEncodingException e) {
            throw new SASException(1, e);
        } catch (LoginException e) {
            throw new SASException(1, e);
        }


        return result;
    }
View Full Code Here

        byte[] distinguishedNameToken = identityToken.dn();
        Any any = null;
        try {
            any = Util.getCodec().decode_value(distinguishedNameToken, X501DistinguishedNameHelper.type());
        } catch (FormatMismatch formatMismatch) {
            throw new SASException(1, formatMismatch);
        } catch (TypeMismatch typeMismatch) {
            throw new SASException(1, typeMismatch);
        }

        byte[] principalNameBytes = X501DistinguishedNameHelper.extract(any);
        Subject subject = new Subject();
        X500Principal x500Principal = new X500Principal(principalNameBytes);
View Full Code Here

TOP

Related Classes of org.apache.geronimo.corba.security.SASException

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.