All Downloads are FREE. Search and download functionalities are using the official Maven repository.

flex.messaging.config.SecurityConstraint Maven / Gradle / Ivy

Go to download

BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe Flex and Adobe AIR applications for more responsive rich Internet application (RIA) experiences.

There is a newer version: 3.2.0.3978
Show newest version
/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  [2002] - [2007] Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 */
package flex.messaging.config;

import java.util.List;
import java.util.Vector;

/**
 * @author Peter Farland
 */
public class SecurityConstraint
{
    public static final String BASIC_AUTH_METHOD = "Basic";
    public static final String CUSTOM_AUTH_METHOD = "Custom";

    private final String id;
    private String method;
    private List roles;

    /**
     * Creates an anonymous SecurityConstraint instance.
     */
    public SecurityConstraint()
    {
        this(null);
    }

    /**
     * Creates a SecurityConstraint instance with an id.
     *
     * @param id The id of the SecurityConstraint instance.
     */
    public SecurityConstraint(String id)
    {
        this.id = id;
        method = CUSTOM_AUTH_METHOD;
    }

    /**
     * Returns a list of roles of the SecurityConstraint.
     *
     * @return List of roles.
     */
    public List getRoles()
    {
        return roles;
    }

    /**
     * Adds a role to the list of roles of the SecurityConstraint.
     *
     * @param role New role to add to the list of roles.
     */
    public void addRole(String role)
    {
        if (role != null)
        {
            if (roles == null)
                roles = new Vector();

            roles.add(role);
        }
    }

    /**
     * Returns the id of the SecurityConstraint.
     *
     * @return The id of the SecurityConstraint.
     */
    public String getId()
    {
        return id;
    }

    /**
     * Returns the authorization method of the SecurityConstraint.
     *
     * @return Authorization method.
     */
    public String getMethod()
    {
        return method;
    }

    /**
     * Sets the authorization method of the SecurityConstraint.
     * Valid values are Basic and Custom.
     *
     * @param method
     */
    public void setMethod(String method)
    {
        if (method != null)
        {
            if (CUSTOM_AUTH_METHOD.equalsIgnoreCase(method))
            {
                this.method = CUSTOM_AUTH_METHOD;
            }
            else if (BASIC_AUTH_METHOD.equalsIgnoreCase(method))
            {
                this.method = BASIC_AUTH_METHOD;
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy