source: fedd/abac-src/ttg/process/AckPolicy.java @ 70caa72

axis_examplecompt_changesinfo-opsversion-2.00version-3.01version-3.02
Last change on this file since 70caa72 was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[8780cbec]1package com.nailabs.abac.process;
2
3import java.util.*;
4import edu.stanford.peer.rbtm.credential.*;
5
6/**
7 * The acknowledgement policy specifies which opponents can be allowed
8 * to receive acknowledgement of credentials possessed by this negotiator.
9 */
10public class AckPolicy implements edu.stanford.peer.rbtm.RBTMConstants,
11                                  java.io.Serializable {
12    /** The policy data store */
13    public HashMap factMap = new HashMap(FACT_MAP_SIZE);
14   
15    /** Add a fact from the supplied strings */
16    public void addAckFact(String base, String roleName, String expr) {
17        try {
18            factMap.put(new Role(base, roleName), 
19                        StaticCredential.getEntityExpression(expr));
20        }
21        catch(Exception ex) {
22            if(DEBUG)ex.printStackTrace();
23        }
24    }
25   
26    /** Add a fact from the supplied object */
27    public void addAckFact(EntityExpression role, EntityExpression req) {
28        factMap.put(role, new AckFact(role, req));
29    }
30
31    /** Return a vector of sensitive roles for the predicate */
32    public Vector getSensitiveRoles() {
33        return new Vector(factMap.keySet());
34    }
35
36    /**
37     * Useful for forward discovery.
38     * @return a set of all roles which satisfy the sensitive requirements
39     */
40    public Vector getRequiredRoles() {
41        return new Vector(factMap.values());
42    }
43
44    /** Query policy for the required role to unlock the role expression */
45    public EntityExpression requires(EntityExpression key) {
46        AckFact fact = (AckFact)factMap.get((Object)key);
47        if(fact == null)
48            return null;
49        else
50            return (EntityExpression)fact.getRequirement();
51    }
52
53    /** Returns the underlying storage data structure in a printable format */
54    public String toString() {
55        return factMap.toString();
56    }
57
58}
Note: See TracBrowser for help on using the repository browser.