/**
 * Credentials.java
 * Created Aug 11, 2006
 * Copyright (C) Tandberg Television 2006
 */
package com.tandbergtv.workflow.auth;

import java.security.Principal;
import java.util.HashSet;
import java.util.Set;

/**
 * Contains the credentials of a principal. This is a value object that provides utility methods
 * for retrieving data related to a principal and the associated acls.
 * 
 * @author Sahil Verma
 */
public class Credentials {

	private Principal principal;
	private Set<String> menus;
	private Set<String> actions;
	private Set<String> sections;
	
	/**
	 * Creates a Credentials object
	 */
	private Credentials() {
		this.menus = new HashSet<String>();
		this.actions = new HashSet<String>();
		this.sections = new HashSet<String>();
	}
	
	/**
	 * Creates a Credentials object
	 * 
	 * @param principal
	 * @param actions
	 * @param sections
	 * @param menus
	 */
	public Credentials(Principal principal, Set<String> actions,
			Set<String> sections, Set<String> menus) {
		this();
		this.principal = principal;
		this.actions = actions;
		this.sections = sections;
		this.menus = menus;

	}
	
	/**
	 * @return Returns the principal.
	 */
	public Principal getPrincipal() {
		return this.principal;
	}

	/**
	 * @return Returns the username.
	 */
	public String getName() {
		return this.principal.getName();
	}

	/**
	 * @return Returns the menus.
	 */
	public Set<String> getMenus() {
		return this.menus;
	}

	/**
	 * @return Returns the actions.
	 */
	public Set<String> getActions() {
		return this.actions;
	}

	/**
	 * @return Returns the sections.
	 */
	public Set<String> getSections() {
		return this.sections;
	}

}
