Package org.apache.axis.security

Examples of org.apache.axis.security.SecurityProvider


     * Authenticate the user and password from the msgContext
     */
    public void invoke(MessageContext msgContext) throws AxisFault {
        category.debug("Enter: SimpleAuthenticationHandler::invoke" );

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null) {
            provider = new SimpleSecurityProvider();
            msgContext.setProperty("securityProvider", provider);
        }

        if (provider != null) {
            String  userID = (String) msgContext.getProperty( MessageContext.USERID );
            category.debug( "User: " + userID );

            // in order to authenticate, the user must exist
            if ( userID == null || userID.equals(""))
                throw new AxisFault( "Server.Unauthenticated",
                    "User '" + userID + "' not authenticated (unknown user)",
                    null, null );

            String passwd = (String) msgContext.getProperty( MessageContext.PASSWORD );
            category.debug( "Pass: " + passwd );

            AuthenticatedUser authUser = provider.authenticate(msgContext);

            // if a password is defined, then it must match
            if ( authUser == null)
                throw new AxisFault( "Server.Unauthenticated",
                    "User '" + userID + "' not authenticated",
View Full Code Here


            }
            category.debug("Exit: SimpleAuthorizationHandler::invoke" );
            return;
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null)
            throw new AxisFault("No security provider in MessageContext!");

        StringTokenizer st = new StringTokenizer(allowedRoles, ",");
        while (st.hasMoreTokens()) {
            String thisRole = st.nextToken();
            if (provider.userMatches(user, thisRole)) {
                category.info("User '" + userID + "' authorized to: "
                              + serviceName);
                category.debug("Exit: SimpleAuthorizationHandler::invoke" );
                return;
            }
View Full Code Here

    public void invoke(MessageContext msgContext) throws AxisFault {
        if (log.isDebugEnabled()) {
            log.debug("Enter: SimpleAuthenticationHandler::invoke");
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null) {
            provider = new SimpleSecurityProvider();
            msgContext.setProperty("securityProvider", provider);
        }

        if (provider != null) {
            String  userID = msgContext.getUsername();
            if (log.isDebugEnabled()) {
                log.debug( JavaUtils.getMessage("user00", userID) );
            }

            // in order to authenticate, the user must exist
            if ( userID == null || userID.equals(""))
                throw new AxisFault( "Server.Unauthenticated",
                    JavaUtils.getMessage("cantAuth00", userID),
                    null, null );

            String passwd = msgContext.getPassword();
            if (log.isDebugEnabled()) {
                log.debug( JavaUtils.getMessage("password00", passwd) );
            }

            AuthenticatedUser authUser = provider.authenticate(msgContext);

            // if a password is defined, then it must match
            if ( authUser == null)
                throw new AxisFault( "Server.Unauthenticated",
                    JavaUtils.getMessage("cantAuth01", userID),
View Full Code Here

                log.debug("Exit: SimpleAuthorizationHandler::invoke");
            }
            return;
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null)
            throw new AxisFault(JavaUtils.getMessage("noSecurity00"));

        StringTokenizer st = new StringTokenizer(allowedRoles, ",");
        while (st.hasMoreTokens()) {
            String thisRole = st.nextToken();
            if (provider.userMatches(user, thisRole)) {

                if (log.isDebugEnabled()) {
                    log.debug(JavaUtils.getMessage("auth01",
                        userID, serviceName));
                }
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Enter: ServletSecurityModel::isUserInRole");
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty(MessageContext.SECURITY_PROVIDER);
        if (provider == null) {
            provider = new SimpleSecurityProvider();
            msgContext.setProperty(MessageContext.SECURITY_PROVIDER, provider);
        }

        if (provider != null) {
            String  userID = msgContext.getUsername();
            if (logger.isDebugEnabled()) {
                logger.debug("user : " + userID );
            }

            // in order to authenticate, the user must exist
            if ( userID == null || userID.equals("") )
            {
                logger.debug("userID is null");
                return false;
            }

            String passwd = msgContext.getPassword();
            if (logger.isDebugEnabled()) {
                logger.debug("password : " + passwd );
            }

            AuthenticatedUser authUser = provider.authenticate(msgContext);

            // if a password is defined, then it must match
            if ( authUser == null) {
                logger.debug("authuser is null");
                return false;
            }

            for ( String role : rolesAllowed )
            {
                if (provider.userMatches( authUser, role ) )
                {
                    // BINGO !!

                    if (logger.isDebugEnabled()) {
                        logger.debug( "auth : " + userID + " is in role [" + role + "]");
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Enter: AxisSecurityModel::isUserInRole");
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty(MessageContext.SECURITY_PROVIDER);
        if ( provider instanceof ServletSecurityProvider )
        {
            // SecurityProvider must not be an instance of ServletSecurityProvider for AxisSecurityModel.
            // Thus, provides SimpleSecurityProvider forcelly.
            provider = new SimpleSecurityProvider();
        }

        if (provider != null) {
            String  userID = msgContext.getUsername();
            if (logger.isDebugEnabled()) {
                logger.debug("user : " + userID );
            }

            // in order to authenticate, the user must exist
            if ( userID == null || userID.equals("") )
            {
                logger.debug("userID is null");
                return false;
            }

            String passwd = msgContext.getPassword();
            if (logger.isDebugEnabled()) {
                logger.debug("password : " + passwd );
            }

            AuthenticatedUser authUser = provider.authenticate(msgContext);

            // if a password is defined, then it must match
            if ( authUser == null) {
                logger.debug("authuser is null");
                return false;
            }

            for ( String role : rolesAllowed )
            {
                if (provider.userMatches( authUser, role ) )
                {
                    // BINGO !!

                    if (logger.isDebugEnabled()) {
                        logger.debug( "auth : " + userID + " is in role [" + role + "]");
View Full Code Here

    public void invoke(MessageContext msgContext) throws AxisFault {
        if (log.isDebugEnabled()) {
            log.debug("Enter: SimpleAuthenticationHandler::invoke");
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null) {
            provider = new SimpleSecurityProvider();
            msgContext.setProperty("securityProvider", provider);
        }

        if (provider != null) {
            String  userID = msgContext.getUsername();
            if (log.isDebugEnabled()) {
                log.debug( Messages.getMessage("user00", userID) );
            }

            // in order to authenticate, the user must exist
            if ( userID == null || userID.equals(""))
                throw new AxisFault( "Server.Unauthenticated",
                    Messages.getMessage("cantAuth00", userID),
                    null, null );

            String passwd = msgContext.getPassword();
            if (log.isDebugEnabled()) {
                log.debug( Messages.getMessage("password00", passwd) );
            }

            AuthenticatedUser authUser = provider.authenticate(msgContext);

            // if a password is defined, then it must match
            if ( authUser == null)
                throw new AxisFault( "Server.Unauthenticated",
                    Messages.getMessage("cantAuth01", userID),
View Full Code Here

                log.debug("Exit: SimpleAuthorizationHandler::invoke");
            }
            return;
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null)
            throw new AxisFault(Messages.getMessage("noSecurity00"));

        StringTokenizer st = new StringTokenizer(allowedRoles, ",");
        while (st.hasMoreTokens()) {
            String thisRole = st.nextToken();
            if (provider.userMatches(user, thisRole)) {

                if (log.isDebugEnabled()) {
                    log.debug(Messages.getMessage("auth01",
                        userID, serviceName));
                }
View Full Code Here

    public void invoke(MessageContext msgContext) throws AxisFault {
        if (log.isDebugEnabled()) {
            log.debug("Enter: SimpleAuthenticationHandler::invoke");
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null) {
            provider = new SimpleSecurityProvider();
            msgContext.setProperty("securityProvider", provider);
        }

        if (provider != null) {
            String  userID = msgContext.getUsername();
            if (log.isDebugEnabled()) {
                log.debug( JavaUtils.getMessage("user00", userID) );
            }

            // in order to authenticate, the user must exist
            if ( userID == null || userID.equals(""))
                throw new AxisFault( "Server.Unauthenticated",
                    JavaUtils.getMessage("cantAuth00", userID),
                    null, null );

            String passwd = msgContext.getPassword();
            if (log.isDebugEnabled()) {
                log.debug( JavaUtils.getMessage("password00", passwd) );
            }

            AuthenticatedUser authUser = provider.authenticate(msgContext);

            // if a password is defined, then it must match
            if ( authUser == null)
                throw new AxisFault( "Server.Unauthenticated",
                    JavaUtils.getMessage("cantAuth01", userID),
View Full Code Here

                log.debug("Exit: SimpleAuthorizationHandler::invoke");
            }
            return;
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null)
            throw new AxisFault(JavaUtils.getMessage("noSecurity00"));

        StringTokenizer st = new StringTokenizer(allowedRoles, ",");
        while (st.hasMoreTokens()) {
            String thisRole = st.nextToken();
            if (provider.userMatches(user, thisRole)) {

                if (log.isDebugEnabled()) {
                    log.debug(JavaUtils.getMessage("auth01",
                        userID, serviceName));
                }
View Full Code Here

TOP

Related Classes of org.apache.axis.security.SecurityProvider

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.