1 | #!/bin/sh |
---|
2 | |
---|
3 | ##################################################################### |
---|
4 | # scenario #1 |
---|
5 | # Explore simple user and project relationship |
---|
6 | # |
---|
7 | # Drd, a geniPI, created a project 'proj1' |
---|
8 | # |
---|
9 | unset ABAC_CN |
---|
10 | keyloc=`pwd` |
---|
11 | sidx=s1 |
---|
12 | |
---|
13 | makeWho() { |
---|
14 | WHO=$1 |
---|
15 | rm -rf ${WHO}_*.pem |
---|
16 | creddy --generate --cn ${WHO} |
---|
17 | } |
---|
18 | makeWho GR |
---|
19 | makeWho IDP |
---|
20 | makeWho EXO |
---|
21 | makeWho Drd |
---|
22 | |
---|
23 | g=`creddy --keyid --cert $keyloc/G_ID.pem` |
---|
24 | gr=`creddy --keyid --cert $keyloc/GR_ID.pem` |
---|
25 | pa=`creddy --keyid --cert $keyloc/PA_ID.pem` |
---|
26 | sa=`creddy --keyid --cert $keyloc/SA_ID.pem` |
---|
27 | idp=`creddy --keyid --cert $keyloc/IDP_ID.pem` |
---|
28 | drd=`creddy --keyid --cert $keyloc/Drd_ID.pem` |
---|
29 | |
---|
30 | pname=${sidx}_yap_clauses |
---|
31 | namespace=access1 |
---|
32 | sfile=sfile_${sidx} |
---|
33 | |
---|
34 | idp_gUser() |
---|
35 | { |
---|
36 | eval "namename=[keyid:\$$1]" |
---|
37 | attr="[keyid:$idp].role:geniUser <- $namename" |
---|
38 | name=${sidx}_IDP_gUser__$1_attr.der |
---|
39 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
40 | } |
---|
41 | |
---|
42 | ############################################################################### |
---|
43 | echo "s/$g/G/g " > $sfile |
---|
44 | echo "s/$gr/GR/g " >> $sfile |
---|
45 | echo "s/$pa/PA/g " >> $sfile |
---|
46 | echo "s/$sa/SA/g " >> $sfile |
---|
47 | echo "s/$idp/IDP/g " >> $sfile |
---|
48 | echo "s/$drd/Drd/g " >> $sfile |
---|
49 | |
---|
50 | # G.geniRoot <- GR |
---|
51 | attr="[keyid:$g].role:geniRoot <- [keyid:$gr]" |
---|
52 | name=${sidx}_G_geniRoot__gr_attr.der |
---|
53 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
54 | |
---|
55 | # GR.sliceAuthority <- SA |
---|
56 | attr="[keyid:$gr].role:sliceAuthority <- [keyid:$sa]" |
---|
57 | name=${sidx}_GR_sliceAuthority__sa_attr.der |
---|
58 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
59 | |
---|
60 | # GR.identityProvider <- IDP |
---|
61 | attr="[keyid:$gr].role:identityProvider <- [keyid:$idp]" |
---|
62 | name=${sidx}_GR_identityProvider__idp_attr.der |
---|
63 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
64 | |
---|
65 | # GR.projectAuthority <- PA |
---|
66 | attr="[keyid:$gr].role:projectAuthority <- [keyid:$pa]" |
---|
67 | name=${sidx}_GR_projAuthority__pa_attr.der |
---|
68 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
69 | |
---|
70 | # IDP.geniUser <- Drd |
---|
71 | idp_gUser drd |
---|
72 | |
---|
73 | # IDP.geniPI <- Drd |
---|
74 | attr="[keyid:$idp].role:geniPI <- [keyid:$drd]" |
---|
75 | name=${sidx}_IDP_geniPI__drd_attr.der |
---|
76 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
77 | |
---|
78 | ## drd requesting a proj1 from pa |
---|
79 | # Drd.project <- 'proj1' |
---|
80 | attr="[keyid:$drd].oset:project <- [string:'proj1']" |
---|
81 | name=${sidx}_Drd_project__proj1_attr.der |
---|
82 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
83 | # PA.standard <- 'proj1' |
---|
84 | attr="[keyid:$pa].oset:standard <- [string:'proj1']" |
---|
85 | name=${sidx}_PA_standard__proj1_attr.der |
---|
86 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
87 | # PA.owner('proj1') <- Drd |
---|
88 | attr="[keyid:$pa].role:owner([string:'proj1']) <- [keyid:$drd]" |
---|
89 | name=${sidx}_PA_owner_proj1__drd_attr.der |
---|
90 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
91 | # PA.root('proj1') <-Drd |
---|
92 | attr="[keyid:$pa].role:root([string:'proj1']) <- [keyid:$drd]" |
---|
93 | name=${sidx}_PA_root_proj1__drd_attr.der |
---|
94 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|