Skip to content

Commit 38d87b7

Browse files
committed
Polishing.
See gh-661 Original pull request: gh-793
1 parent 8723f9b commit 38d87b7

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
@@ -58,6 +58,7 @@
5858
* @author Luander Ribeiro
5959
* @author Mikko Koli
6060
* @author My-Lan Aragon
61+
* @author Nanne Baars
6162
*/
6263
public class VaultTransitTemplate implements VaultTransitOperations {
6364

@@ -537,13 +538,19 @@ static class VaultTransitKeyImpl implements VaultTransitKey {
537538
@Nullable
538539
private String name;
539540

540-
@JsonProperty("cipher_mode")
541-
private String cipherMode = "";
542-
543541
@JsonProperty("type")
544542
@Nullable
545543
private String type;
546544

545+
@JsonProperty("allow_plaintext_backup")
546+
private boolean allowPlaintextBackup;
547+
548+
@JsonProperty("cipher_mode")
549+
private String cipherMode = "";
550+
551+
@JsonProperty("convergent_encryption_version")
552+
private int convergentVersion;
553+
547554
@JsonProperty("deletion_allowed")
548555
private boolean deletionAllowed;
549556

@@ -562,28 +569,32 @@ static class VaultTransitKeyImpl implements VaultTransitKey {
562569
@JsonProperty("min_encryption_version")
563570
private int minEncryptionVersion;
564571

572+
@JsonProperty("convergent_encryption")
573+
private boolean supportsConvergentEncryption;
574+
565575
@JsonProperty("supports_decryption")
566576
private boolean supportsDecryption;
567577

568-
@JsonProperty("supports_encryption")
569-
private boolean supportsEncryption;
570-
571578
@JsonProperty("supports_derivation")
572579
private boolean supportsDerivation;
573580

581+
@JsonProperty("supports_encryption")
582+
private boolean supportsEncryption;
583+
574584
@JsonProperty("supports_signing")
575585
private boolean supportsSigning;
576586

577-
@JsonProperty("allow_plaintext_backup")
578-
private boolean allowPlaintextBackup;
579-
580-
@JsonProperty("convergent_encryption")
581-
private boolean supportsConvergentEncryption;
587+
public VaultTransitKeyImpl() {
588+
}
582589

583-
@JsonProperty("convergent_encryption_version")
584-
private int convergentVersion;
590+
@Override
591+
@Nullable
592+
public String getName() {
593+
return this.name;
594+
}
585595

586-
public VaultTransitKeyImpl() {
596+
public void setName(@Nullable String name) {
597+
this.name = name;
587598
}
588599

589600
@Override
@@ -596,166 +607,165 @@ public String getType() {
596607
return this.cipherMode;
597608
}
598609

599-
@Override
600-
public boolean supportsDecryption() {
601-
return isSupportsDecryption();
602-
}
603-
604-
@Override
605-
public boolean supportsEncryption() {
606-
return isSupportsEncryption();
610+
public void setType(@Nullable String type) {
611+
this.type = type;
607612
}
608613

609614
@Override
610-
public boolean supportsDerivation() {
611-
return isSupportsDerivation();
615+
public boolean allowPlaintextBackup() {
616+
return isAllowPlaintextBackup();
612617
}
613618

614-
@Override
615-
public boolean supportsSigning() {
616-
return isSupportsSigning();
619+
public boolean isAllowPlaintextBackup() {
620+
return this.allowPlaintextBackup;
617621
}
618622

619-
@Override
620-
public boolean allowPlaintextBackup() {
621-
return isAllowPlaintextBackup();
623+
public String getCipherMode() {
624+
return this.cipherMode;
622625
}
623626

624-
@Override
625-
public boolean supportsConvergentEncryption() {
626-
return isSupportsConvergentEncryption();
627+
public void setCipherMode(String cipherMode) {
628+
this.cipherMode = cipherMode;
627629
}
628630

629631
@Override
630632
public int getConvergentVersion() {
631633
return this.convergentVersion;
632634
}
633635

634-
@Nullable
635-
public String getName() {
636-
return this.name;
637-
}
638-
639-
public String getCipherMode() {
640-
return this.cipherMode;
641-
}
642-
636+
@Override
643637
public boolean isDeletionAllowed() {
644638
return this.deletionAllowed;
645639
}
646640

641+
public void setDeletionAllowed(boolean deletionAllowed) {
642+
this.deletionAllowed = deletionAllowed;
643+
}
644+
645+
@Override
647646
public boolean isDerived() {
648647
return this.derived;
649648
}
650649

650+
public void setDerived(boolean derived) {
651+
this.derived = derived;
652+
}
653+
654+
@Override
651655
public boolean isExportable() {
652656
return this.exportable;
653657
}
654658

659+
public void setExportable(boolean exportable) {
660+
this.exportable = exportable;
661+
}
662+
663+
@Override
655664
public Map<String, Object> getKeys() {
656665
return this.keys;
657666
}
658667

659-
public int getLatestVersion() {
660-
return this.latestVersion;
668+
public void setKeys(Map<String, Object> keys) {
669+
this.keys = keys;
661670
}
662671

663-
public int getMinDecryptionVersion() {
664-
return this.minDecryptionVersion;
672+
@Override
673+
public int getLatestVersion() {
674+
return this.latestVersion;
665675
}
666676

667-
public int getMinEncryptionVersion() {
668-
return this.minEncryptionVersion;
677+
public void setLatestVersion(int latestVersion) {
678+
this.latestVersion = latestVersion;
669679
}
670680

671-
public boolean isAllowPlaintextBackup() {
672-
return this.allowPlaintextBackup;
681+
@Override
682+
public int getMinDecryptionVersion() {
683+
return this.minDecryptionVersion;
673684
}
674685

675-
public boolean isSupportsDecryption() {
676-
return this.supportsDecryption;
686+
public void setMinDecryptionVersion(int minDecryptionVersion) {
687+
this.minDecryptionVersion = minDecryptionVersion;
677688
}
678689

679-
public boolean isSupportsEncryption() {
680-
return this.supportsEncryption;
690+
public void setSupportsEncryption(boolean supportsEncryption) {
691+
this.supportsEncryption = supportsEncryption;
681692
}
682693

683-
public boolean isSupportsDerivation() {
684-
return this.supportsDerivation;
694+
@Override
695+
public int getMinEncryptionVersion() {
696+
return this.minEncryptionVersion;
685697
}
686698

687-
public boolean isSupportsSigning() {
688-
return this.supportsSigning;
699+
public void setMinEncryptionVersion(int minEncryptionVersion) {
700+
this.minEncryptionVersion = minEncryptionVersion;
689701
}
690702

691703
public boolean isSupportsConvergentEncryption() {
692704
return this.supportsConvergentEncryption;
693705
}
694706

695-
public void setName(@Nullable String name) {
696-
this.name = name;
697-
}
698-
699-
public void setCipherMode(String cipherMode) {
700-
this.cipherMode = cipherMode;
701-
}
702-
703-
public void setType(@Nullable String type) {
704-
this.type = type;
705-
}
706-
707-
public void setDeletionAllowed(boolean deletionAllowed) {
708-
this.deletionAllowed = deletionAllowed;
709-
}
710-
711-
public void setDerived(boolean derived) {
712-
this.derived = derived;
707+
@Override
708+
public boolean supportsConvergentEncryption() {
709+
return isSupportsConvergentEncryption();
713710
}
714711

715-
public void setExportable(boolean exportable) {
716-
this.exportable = exportable;
712+
public boolean isSupportsDecryption() {
713+
return this.supportsDecryption;
717714
}
718715

719-
public void setKeys(Map<String, Object> keys) {
720-
this.keys = keys;
716+
@Override
717+
public boolean supportsDecryption() {
718+
return isSupportsDecryption();
721719
}
722720

723-
public void setLatestVersion(int latestVersion) {
724-
this.latestVersion = latestVersion;
721+
public void setSupportsDecryption(boolean supportsDecryption) {
722+
this.supportsDecryption = supportsDecryption;
725723
}
726724

727-
public void setMinDecryptionVersion(int minDecryptionVersion) {
728-
this.minDecryptionVersion = minDecryptionVersion;
725+
public boolean isSupportsEncryption() {
726+
return this.supportsEncryption;
729727
}
730728

731-
public void setMinEncryptionVersion(int minEncryptionVersion) {
732-
this.minEncryptionVersion = minEncryptionVersion;
729+
@Override
730+
public boolean supportsEncryption() {
731+
return isSupportsEncryption();
733732
}
734733

735-
public void setSupportsDecryption(boolean supportsDecryption) {
736-
this.supportsDecryption = supportsDecryption;
734+
@Override
735+
public boolean supportsDerivation() {
736+
return isSupportsDerivation();
737737
}
738738

739-
public void setSupportsEncryption(boolean supportsEncryption) {
740-
this.supportsEncryption = supportsEncryption;
739+
public boolean isSupportsDerivation() {
740+
return this.supportsDerivation;
741741
}
742742

743743
public void setSupportsDerivation(boolean supportsDerivation) {
744744
this.supportsDerivation = supportsDerivation;
745745
}
746746

747+
public boolean isSupportsSigning() {
748+
return this.supportsSigning;
749+
}
750+
747751
public void setSupportsSigning(boolean supportsSigning) {
748752
this.supportsSigning = supportsSigning;
749753
}
750754

755+
@Override
756+
public boolean supportsSigning() {
757+
return isSupportsSigning();
758+
}
759+
751760
@Override
752761
public boolean equals(Object o) {
753762
if (this == o)
754763
return true;
755764
if (!(o instanceof VaultTransitKeyImpl))
756765
return false;
757766
VaultTransitKeyImpl that = (VaultTransitKeyImpl) o;
758-
return this.deletionAllowed == that.deletionAllowed && this.derived == that.derived
767+
return this.allowPlaintextBackup == that.allowPlaintextBackup
768+
&& this.deletionAllowed == that.deletionAllowed && this.derived == that.derived
759769
&& this.exportable == that.exportable && this.latestVersion == that.latestVersion
760770
&& this.minDecryptionVersion == that.minDecryptionVersion
761771
&& this.minEncryptionVersion == that.minEncryptionVersion
@@ -764,17 +774,15 @@ public boolean equals(Object o) {
764774
&& this.supportsDerivation == that.supportsDerivation
765775
&& this.supportsSigning == that.supportsSigning && Objects.equals(this.name, that.name)
766776
&& this.cipherMode.equals(that.cipherMode) && Objects.equals(this.type, that.type)
767-
&& this.allowPlaintextBackup == that.allowPlaintextBackup
768777
&& this.supportsConvergentEncryption == that.supportsConvergentEncryption;
769778
}
770779

771780
@Override
772781
public int hashCode() {
773-
return Objects.hash(this.name, this.cipherMode, this.type, this.deletionAllowed, this.derived,
774-
this.exportable, this.keys, this.latestVersion, this.minDecryptionVersion,
782+
return Objects.hash(this.allowPlaintextBackup, this.name, this.cipherMode, this.type, this.deletionAllowed,
783+
this.derived, this.exportable, this.keys, this.latestVersion, this.minDecryptionVersion,
775784
this.minEncryptionVersion, this.supportsDecryption, this.supportsEncryption,
776-
this.supportsDerivation, this.supportsSigning, this.allowPlaintextBackup,
777-
this.supportsConvergentEncryption);
785+
this.supportsDerivation, this.supportsSigning, this.supportsConvergentEncryption);
778786
}
779787

780788
}
@@ -789,10 +797,12 @@ static class RawTransitKeyImpl implements RawTransitKey {
789797
public RawTransitKeyImpl() {
790798
}
791799

800+
@Override
792801
public Map<String, String> getKeys() {
793802
return this.keys;
794803
}
795804

805+
@Override
796806
@Nullable
797807
public String getName() {
798808
return this.name;

0 commit comments

Comments
 (0)