package eu.dnetlib.enabling.aas.ctx;

import eu.dnetlib.enabling.aas.rmi.Attribute;
import eu.dnetlib.enabling.aas.rmi.Obligation;
import eu.dnetlib.enabling.aas.rmi.TypedString;

/**
 * Security context information related to a resource.
 * Released for each resource that successfully authenticates.
 * 
 * @author mhorst
 *
 */
public class SecurityContext {
	
	private String secCtxId;
	private String resourceId;
	
	private String secCtxType;
	private String secCtxKind;
	
	private byte[] privKey;
	private byte[] pubKey;
	
	private long creationTime;
	private long lastAccessTime;
	
	private TypedString[] identities;
	private Obligation[] obligations;
	private Attribute[] attributes;
	

	/**
	 * Constructor for SOAP purposes.
	 */
	public SecurityContext() {
	}
	/**
	 * Default constructor
	 */
	SecurityContext(String secCtxId, String resourceId) {
		this.secCtxId = secCtxId;
		this.resourceId = resourceId;
	}

	/**
	 * Returns SecurityContext identifier.
	 * @return secCtxId
	 */
	public String getSecCtxId() {
		return secCtxId;
	}

	/**
	 * Sets SecurityContext identifier.
	 * @param secCtxId
	 */
	public void setSecCtxId(String secCtxId) {
		this.secCtxId = secCtxId;
	}
	
	/**
	 * Returns resource id associated with security context.
	 * @return resource id
	 */
	public String getResourceId() {
		return resourceId;
	}

	/**
	 * Sets resource id for security context.
	 * @param resourceId
	 */
	public void setResourceId(String resourceId) {
		this.resourceId = resourceId;
	}
	
	/**
	 * Returns secCtx kind.
	 * @return secCtx kind
	 */
	public String getSecCtxKind() {
		return secCtxKind;
	}
	
	/**
	 * Sets secCtx kind.
	 * @param secCtxKind
	 */
	public void setSecCtxKind(String secCtxKind) {
		this.secCtxKind = secCtxKind;
	}
	
	/**
	 * Returns secCtx type.
	 * @return secCtx type
	 */
	public String getSecCtxType() {
		return secCtxType;
	}
	
	/**
	 * Sets secCtx type.
	 * @param secCtxType
	 */
	public void setSecCtxType(String secCtxType) {
		this.secCtxType = secCtxType;
	}
	
	/**
	 * Returns last access time.
	 * @return lastAccessTime
	 */
	public long getLastAccessTime() {
		return lastAccessTime;
	}
	
	/**
	 * Sets last access time.
	 * @param lastAccessTime
	 */
	public void setLastAccessTime(long lastAccessTime) {
		this.lastAccessTime = lastAccessTime;
	}
	
	/**
	 * Returns secCtx creation time.
	 * @return creationTime
	 */
	public long getCreationTime() {
		return creationTime;
	}

	/**
	 * Sets secCtx creation time.
	 * @param creationTime
	 */
	public void setCreationTime(long lastAccessTime) {
		this.creationTime = lastAccessTime;
	}

	/**
	 * Returns private key of SecCTX.
	 * @return private key of SecCTX
	 */
	public byte[] getPrivKey() {
		return privKey;
	}

	/**
	 * Sets private key for SecCTX.
	 * @param privKey
	 */
	public void setPrivKey(byte[] privKey) {
		this.privKey = privKey;
	}

	/**
	 * Returns public key of SecCTX.
	 * @return public key of SecCTX
	 */
	public byte[] getPubKey() {
		return pubKey;
	}

	/**
	 * Sets public key for SecCTX.
	 * @param pubKey
	 */
	public void setPubKey(byte[] pubKey) {
		this.pubKey = pubKey;
	}
	
	/**
	 * Returns identities of SecCTX.
	 * @return identities
	 */
	public TypedString[] getIdentities() {
		return identities;
	}

	/**
	 * Sets identities for SecCTX.
	 * @param identities
	 */
	public void setIdentities(TypedString[] identities) {
		this.identities = identities;
	}

	/**
	 * Returns obligations of SecCTX.
	 * @return obligations
	 */
	public Obligation[] getObligations() {
		return obligations;
	}

	/**
	 * Sets obligations for SecCTX.
	 * @param obligations
	 */
	public void setObligations(Obligation[] obligations) {
		this.obligations = obligations;
	}
	
	/**
	 * Returns SecCTX attributes.
	 * @return SecCTX attributes
	 */
	public Attribute[] getAttributes() {
		return attributes;
	}

	/**
	 * Gets attributes from SecCTX.
	 * @param attributes
	 */
	public void setAttributes(Attribute[] attributes) {
		this.attributes = attributes;
	}


}
