Skip to content

Commit a798463

Browse files
committed
Polishing.
See gh-661 Original pull request: gh-793
1 parent 92eef9f commit a798463

File tree

3 files changed

+142
-119
lines changed

3 files changed

+142
-119
lines changed

spring-vault-core/src/main/java/org/springframework/vault/core/VaultTransitTemplate.java

Lines changed: 106 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
* @author Luander Ribeiro
5858
* @author Mikko Koli
5959
* @author My-Lan Aragon
60+
* @author Nanne Baars
6061
*/
6162
public class VaultTransitTemplate implements VaultTransitOperations {
6263

@@ -559,13 +560,19 @@ static class VaultTransitKeyImpl implements VaultTransitKey {
559560
@Nullable
560561
private String name;
561562

562-
@JsonProperty("cipher_mode")
563-
private String cipherMode = "";
564-
565563
@JsonProperty("type")
566564
@Nullable
567565
private String type;
568566

567+
@JsonProperty("allow_plaintext_backup")
568+
private boolean allowPlaintextBackup;
569+
570+
@JsonProperty("cipher_mode")
571+
private String cipherMode = "";
572+
573+
@JsonProperty("convergent_encryption_version")
574+
private int convergentVersion;
575+
569576
@JsonProperty("deletion_allowed")
570577
private boolean deletionAllowed;
571578

@@ -584,28 +591,32 @@ static class VaultTransitKeyImpl implements VaultTransitKey {
584591
@JsonProperty("min_encryption_version")
585592
private int minEncryptionVersion;
586593

594+
@JsonProperty("convergent_encryption")
595+
private boolean supportsConvergentEncryption;
596+
587597
@JsonProperty("supports_decryption")
588598
private boolean supportsDecryption;
589599

590-
@JsonProperty("supports_encryption")
591-
private boolean supportsEncryption;
592-
593600
@JsonProperty("supports_derivation")
594601
private boolean supportsDerivation;
595602

603+
@JsonProperty("supports_encryption")
604+
private boolean supportsEncryption;
605+
596606
@JsonProperty("supports_signing")
597607
private boolean supportsSigning;
598608

599-
@JsonProperty("allow_plaintext_backup")
600-
private boolean allowPlaintextBackup;
601-
602-
@JsonProperty("convergent_encryption")
603-
private boolean supportsConvergentEncryption;
609+
public VaultTransitKeyImpl() {
610+
}
604611

605-
@JsonProperty("convergent_encryption_version")
606-
private int convergentVersion;
612+
@Override
613+
@Nullable
614+
public String getName() {
615+
return this.name;
616+
}
607617

608-
public VaultTransitKeyImpl() {
618+
public void setName(@Nullable String name) {
619+
this.name = name;
609620
}
610621

611622
@Override
@@ -618,166 +629,165 @@ public String getType() {
618629
return this.cipherMode;
619630
}
620631

621-
@Override
622-
public boolean supportsDecryption() {
623-
return isSupportsDecryption();
624-
}
625-
626-
@Override
627-
public boolean supportsEncryption() {
628-
return isSupportsEncryption();
632+
public void setType(@Nullable String type) {
633+
this.type = type;
629634
}
630635

631636
@Override
632-
public boolean supportsDerivation() {
633-
return isSupportsDerivation();
637+
public boolean allowPlaintextBackup() {
638+
return isAllowPlaintextBackup();
634639
}
635640

636-
@Override
637-
public boolean supportsSigning() {
638-
return isSupportsSigning();
641+
public boolean isAllowPlaintextBackup() {
642+
return this.allowPlaintextBackup;
639643
}
640644

641-
@Override
642-
public boolean allowPlaintextBackup() {
643-
return isAllowPlaintextBackup();
645+
public String getCipherMode() {
646+
return this.cipherMode;
644647
}
645648

646-
@Override
647-
public boolean supportsConvergentEncryption() {
648-
return isSupportsConvergentEncryption();
649+
public void setCipherMode(String cipherMode) {
650+
this.cipherMode = cipherMode;
649651
}
650652

651653
@Override
652654
public int getConvergentVersion() {
653655
return this.convergentVersion;
654656
}
655657

656-
@Nullable
657-
public String getName() {
658-
return this.name;
659-
}
660-
661-
public String getCipherMode() {
662-
return this.cipherMode;
663-
}
664-
658+
@Override
665659
public boolean isDeletionAllowed() {
666660
return this.deletionAllowed;
667661
}
668662

663+
public void setDeletionAllowed(boolean deletionAllowed) {
664+
this.deletionAllowed = deletionAllowed;
665+
}
666+
667+
@Override
669668
public boolean isDerived() {
670669
return this.derived;
671670
}
672671

672+
public void setDerived(boolean derived) {
673+
this.derived = derived;
674+
}
675+
676+
@Override
673677
public boolean isExportable() {
674678
return this.exportable;
675679
}
676680

681+
public void setExportable(boolean exportable) {
682+
this.exportable = exportable;
683+
}
684+
685+
@Override
677686
public Map<String, Object> getKeys() {
678687
return this.keys;
679688
}
680689

681-
public int getLatestVersion() {
682-
return this.latestVersion;
690+
public void setKeys(Map<String, Object> keys) {
691+
this.keys = keys;
683692
}
684693

685-
public int getMinDecryptionVersion() {
686-
return this.minDecryptionVersion;
694+
@Override
695+
public int getLatestVersion() {
696+
return this.latestVersion;
687697
}
688698

689-
public int getMinEncryptionVersion() {
690-
return this.minEncryptionVersion;
699+
public void setLatestVersion(int latestVersion) {
700+
this.latestVersion = latestVersion;
691701
}
692702

693-
public boolean isAllowPlaintextBackup() {
694-
return this.allowPlaintextBackup;
703+
@Override
704+
public int getMinDecryptionVersion() {
705+
return this.minDecryptionVersion;
695706
}
696707

697-
public boolean isSupportsDecryption() {
698-
return this.supportsDecryption;
708+
public void setMinDecryptionVersion(int minDecryptionVersion) {
709+
this.minDecryptionVersion = minDecryptionVersion;
699710
}
700711

701-
public boolean isSupportsEncryption() {
702-
return this.supportsEncryption;
712+
public void setSupportsEncryption(boolean supportsEncryption) {
713+
this.supportsEncryption = supportsEncryption;
703714
}
704715

705-
public boolean isSupportsDerivation() {
706-
return this.supportsDerivation;
716+
@Override
717+
public int getMinEncryptionVersion() {
718+
return this.minEncryptionVersion;
707719
}
708720

709-
public boolean isSupportsSigning() {
710-
return this.supportsSigning;
721+
public void setMinEncryptionVersion(int minEncryptionVersion) {
722+
this.minEncryptionVersion = minEncryptionVersion;
711723
}
712724

713725
public boolean isSupportsConvergentEncryption() {
714726
return this.supportsConvergentEncryption;
715727
}
716728

717-
public void setName(@Nullable String name) {
718-
this.name = name;
719-
}
720-
721-
public void setCipherMode(String cipherMode) {
722-
this.cipherMode = cipherMode;
723-
}
724-
725-
public void setType(@Nullable String type) {
726-
this.type = type;
727-
}
728-
729-
public void setDeletionAllowed(boolean deletionAllowed) {
730-
this.deletionAllowed = deletionAllowed;
731-
}
732-
733-
public void setDerived(boolean derived) {
734-
this.derived = derived;
729+
@Override
730+
public boolean supportsConvergentEncryption() {
731+
return isSupportsConvergentEncryption();
735732
}
736733

737-
public void setExportable(boolean exportable) {
738-
this.exportable = exportable;
734+
public boolean isSupportsDecryption() {
735+
return this.supportsDecryption;
739736
}
740737

741-
public void setKeys(Map<String, Object> keys) {
742-
this.keys = keys;
738+
@Override
739+
public boolean supportsDecryption() {
740+
return isSupportsDecryption();
743741
}
744742

745-
public void setLatestVersion(int latestVersion) {
746-
this.latestVersion = latestVersion;
743+
public void setSupportsDecryption(boolean supportsDecryption) {
744+
this.supportsDecryption = supportsDecryption;
747745
}
748746

749-
public void setMinDecryptionVersion(int minDecryptionVersion) {
750-
this.minDecryptionVersion = minDecryptionVersion;
747+
public boolean isSupportsEncryption() {
748+
return this.supportsEncryption;
751749
}
752750

753-
public void setMinEncryptionVersion(int minEncryptionVersion) {
754-
this.minEncryptionVersion = minEncryptionVersion;
751+
@Override
752+
public boolean supportsEncryption() {
753+
return isSupportsEncryption();
755754
}
756755

757-
public void setSupportsDecryption(boolean supportsDecryption) {
758-
this.supportsDecryption = supportsDecryption;
756+
@Override
757+
public boolean supportsDerivation() {
758+
return isSupportsDerivation();
759759
}
760760

761-
public void setSupportsEncryption(boolean supportsEncryption) {
762-
this.supportsEncryption = supportsEncryption;
761+
public boolean isSupportsDerivation() {
762+
return this.supportsDerivation;
763763
}
764764

765765
public void setSupportsDerivation(boolean supportsDerivation) {
766766
this.supportsDerivation = supportsDerivation;
767767
}
768768

769+
public boolean isSupportsSigning() {
770+
return this.supportsSigning;
771+
}
772+
769773
public void setSupportsSigning(boolean supportsSigning) {
770774
this.supportsSigning = supportsSigning;
771775
}
772776

777+
@Override
778+
public boolean supportsSigning() {
779+
return isSupportsSigning();
780+
}
781+
773782
@Override
774783
public boolean equals(Object o) {
775784
if (this == o)
776785
return true;
777786
if (!(o instanceof VaultTransitKeyImpl))
778787
return false;
779788
VaultTransitKeyImpl that = (VaultTransitKeyImpl) o;
780-
return this.deletionAllowed == that.deletionAllowed && this.derived == that.derived
789+
return this.allowPlaintextBackup == that.allowPlaintextBackup
790+
&& this.deletionAllowed == that.deletionAllowed && this.derived == that.derived
781791
&& this.exportable == that.exportable && this.latestVersion == that.latestVersion
782792
&& this.minDecryptionVersion == that.minDecryptionVersion
783793
&& this.minEncryptionVersion == that.minEncryptionVersion
@@ -786,17 +796,15 @@ public boolean equals(Object o) {
786796
&& this.supportsDerivation == that.supportsDerivation
787797
&& this.supportsSigning == that.supportsSigning && Objects.equals(this.name, that.name)
788798
&& this.cipherMode.equals(that.cipherMode) && Objects.equals(this.type, that.type)
789-
&& this.allowPlaintextBackup == that.allowPlaintextBackup
790799
&& this.supportsConvergentEncryption == that.supportsConvergentEncryption;
791800
}
792801

793802
@Override
794803
public int hashCode() {
795-
return Objects.hash(this.name, this.cipherMode, this.type, this.deletionAllowed, this.derived,
796-
this.exportable, this.keys, this.latestVersion, this.minDecryptionVersion,
804+
return Objects.hash(this.allowPlaintextBackup, this.name, this.cipherMode, this.type, this.deletionAllowed,
805+
this.derived, this.exportable, this.keys, this.latestVersion, this.minDecryptionVersion,
797806
this.minEncryptionVersion, this.supportsDecryption, this.supportsEncryption,
798-
this.supportsDerivation, this.supportsSigning, this.allowPlaintextBackup,
799-
this.supportsConvergentEncryption);
807+
this.supportsDerivation, this.supportsSigning, this.supportsConvergentEncryption);
800808
}
801809

802810
}
@@ -811,10 +819,12 @@ static class RawTransitKeyImpl implements RawTransitKey {
811819
public RawTransitKeyImpl() {
812820
}
813821

822+
@Override
814823
public Map<String, String> getKeys() {
815824
return this.keys;
816825
}
817826

827+
@Override
818828
@Nullable
819829
public String getName() {
820830
return this.name;

0 commit comments

Comments
 (0)