@@ -63,10 +63,26 @@ private Autoconfigure() {
6363 }
6464
6565 static class KeySplitTemplate {
66- final String kas ;
67- final String splitID ;
68- final String kid ;
69- final KeyType keyType ;
66+ private final String kas ;
67+ private final String splitID ;
68+ private final String kid ;
69+ private final KeyType keyType ;
70+
71+ public String getKas () {
72+ return kas ;
73+ }
74+
75+ public String getSplitID () {
76+ return splitID ;
77+ }
78+
79+ public String getKid () {
80+ return kid ;
81+ }
82+
83+ public KeyType getKeyType () {
84+ return keyType ;
85+ }
7086
7187 @ Override
7288 public String toString () {
@@ -99,8 +115,16 @@ public KeySplitTemplate(String kas, String splitID, String kid, KeyType keyType)
99115 }
100116
101117 public static class KeySplitStep {
102- final String kas ;
103- final String splitID ;
118+ private final String kas ;
119+ private final String splitID ;
120+
121+ public String getKas () {
122+ return kas ;
123+ }
124+
125+ public String getSplitID () {
126+ return splitID ;
127+ }
104128
105129 KeySplitStep (String kas , String splitId ) {
106130 this .kas = Objects .requireNonNull (kas );
@@ -289,8 +313,16 @@ String name() {
289313 }
290314
291315 static class KeyAccessGrant {
292- public Attribute attr ;
293- public List <String > kases ;
316+ private Attribute attr ;
317+ private List <String > kases ;
318+
319+ public Attribute getAttr () {
320+ return attr ;
321+ }
322+
323+ public List <String > getKases () {
324+ return kases ;
325+ }
294326
295327 public KeyAccessGrant (Attribute attr , List <String > kases ) {
296328 this .attr = attr ;
@@ -349,11 +381,11 @@ boolean addAllGrants(AttributeValueFQN fqn, List<KeyAccessServer> granted, List<
349381
350382 for (var cachedGrantKey : cachedGrantKeys ) {
351383 var mappedKey = new Config .KASInfo ();
352- mappedKey .URL = grantedKey .getUri ();
353- mappedKey .KID = cachedGrantKey .getKid ();
354- mappedKey .Algorithm = KeyType .fromPublicKeyAlgorithm (cachedGrantKey .getAlg ()).toString ();
355- mappedKey .PublicKey = cachedGrantKey .getPem ();
356- mappedKey .Default = false ;
384+ mappedKey .setURL ( grantedKey .getUri () );
385+ mappedKey .setKID ( cachedGrantKey .getKid () );
386+ mappedKey .setAlgorithm ( KeyType .fromPublicKeyAlgorithm (cachedGrantKey .getAlg ()).toString () );
387+ mappedKey .setPublicKey ( cachedGrantKey .getPem () );
388+ mappedKey .setDefault ( false ) ;
357389 mappedKeys .computeIfAbsent (fqn .key , k -> new ArrayList <>()).add (mappedKey );
358390 }
359391 }
@@ -512,11 +544,11 @@ BooleanKeyExpression assignKeysTo(AttributeBooleanExpression e) {
512544 continue ;
513545 }
514546 for (var kasInfo : mapped ) {
515- if (kasInfo .URL == null || kasInfo .URL .isEmpty ()) {
547+ if (kasInfo .getURL () == null || kasInfo .getURL () .isEmpty ()) {
516548 logger .warn ("No KAS URL found for attribute value {}" , value );
517549 continue ;
518550 }
519- keys .add (new PublicKeyInfo (kasInfo .URL , kasInfo .KID , kasInfo .Algorithm ));
551+ keys .add (new PublicKeyInfo (kasInfo .getURL () , kasInfo .getKID () , kasInfo .getAlgorithm () ));
520552 }
521553 }
522554
@@ -615,9 +647,17 @@ public String toString() {
615647 }
616648
617649 static class PublicKeyInfo implements Comparable <PublicKeyInfo > {
618- final String kas ;
619- final String kid ;
620- final String algorithm ;
650+ private final String kas ;
651+ private final String kid ;
652+ private final String algorithm ;
653+
654+ public String getKas () {
655+ return kas ;
656+ }
657+
658+ public String getKid () { return kid ; }
659+
660+ public String getAlgorithm () { return algorithm ; }
621661
622662 PublicKeyInfo (String kas ) {
623663 this (kas , null , null );
@@ -629,10 +669,6 @@ static class PublicKeyInfo implements Comparable<PublicKeyInfo> {
629669 this .algorithm = algorithm ;
630670 }
631671
632- String getKas () {
633- return kas ;
634- }
635-
636672 @ Override
637673 public boolean equals (Object o ) {
638674 if (o == null || getClass () != o .getClass ()) return false ;
@@ -884,11 +920,11 @@ static Granter newGranterFromService(AttributesServiceClientInterface as, KASKey
884920
885921 static Autoconfigure .Granter createGranter (SDK .Services services , Config .TDFConfig tdfConfig ) {
886922 Autoconfigure .Granter granter = new Autoconfigure .Granter (new ArrayList <>());
887- if (tdfConfig .attributeValues != null && !tdfConfig .attributeValues .isEmpty ()) {
888- granter = Autoconfigure .newGranterFromAttributes (services .kas ().getKeyCache (), tdfConfig .attributeValues .toArray (new Value [0 ]));
889- } else if (tdfConfig .attributes != null && !tdfConfig .attributes .isEmpty ()) {
923+ if (tdfConfig .getAttributeValues () != null && !tdfConfig .getAttributeValues () .isEmpty ()) {
924+ granter = Autoconfigure .newGranterFromAttributes (services .kas ().getKeyCache (), tdfConfig .getAttributeValues () .toArray (new Value [0 ]));
925+ } else if (tdfConfig .getAttributes () != null && !tdfConfig .getAttributes () .isEmpty ()) {
890926 granter = Autoconfigure .newGranterFromService (services .attributes (), services .kas ().getKeyCache (),
891- tdfConfig .attributes .toArray (new Autoconfigure .AttributeValueFQN [0 ]));
927+ tdfConfig .getAttributes () .toArray (new Autoconfigure .AttributeValueFQN [0 ]));
892928 }
893929 return granter ;
894930 }
0 commit comments