diff --git a/src/main/java/org/kohsuke/github/GHMeta.java b/src/main/java/org/kohsuke/github/GHMeta.java index bfa900f7eb..25cbcb0c3c 100644 --- a/src/main/java/org/kohsuke/github/GHMeta.java +++ b/src/main/java/org/kohsuke/github/GHMeta.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; // TODO: Auto-generated Javadoc /** @@ -12,7 +13,8 @@ * * @author Paulo Miguel Almeida * @see GitHub#getMeta() GitHub#getMeta() - * @see Get Meta + * @see Get + * Meta */ public class GHMeta { @@ -24,6 +26,10 @@ public GHMeta() { @JsonProperty("verifiable_password_authentication") private boolean verifiablePasswordAuthentication; + @JsonProperty("ssh_key_fingerprints") + private Map sshKeyFingerprints; + @JsonProperty("ssh_keys") + private List sshKeys; private List hooks; private List git; private List web; @@ -43,6 +49,24 @@ public boolean isVerifiablePasswordAuthentication() { return verifiablePasswordAuthentication; } + /** + * Gets ssh key fingerprints. + * + * @return the ssh key fingerprints + */ + public Map getSshKeyFingerprints() { + return Collections.unmodifiableMap(sshKeyFingerprints); + } + + /** + * Gets ssh keys. + * + * @return the ssh keys + */ + public List getSshKeys() { + return Collections.unmodifiableList(sshKeys); + } + /** * Gets hooks. * diff --git a/src/test/java/org/kohsuke/github/GitHubTest.java b/src/test/java/org/kohsuke/github/GitHubTest.java index ada391e326..fe277899ed 100644 --- a/src/test/java/org/kohsuke/github/GitHubTest.java +++ b/src/test/java/org/kohsuke/github/GitHubTest.java @@ -283,6 +283,8 @@ public void testListMyAuthorizations() throws IOException { public void getMeta() throws IOException { GHMeta meta = gitHub.getMeta(); assertThat(meta.isVerifiablePasswordAuthentication(), is(true)); + assertThat(meta.getSshKeyFingerprints().size(), equalTo(4)); + assertThat(meta.getSshKeys().size(), equalTo(3)); assertThat(meta.getApi().size(), equalTo(19)); assertThat(meta.getGit().size(), equalTo(36)); assertThat(meta.getHooks().size(), equalTo(4)); diff --git a/src/test/resources/org/kohsuke/github/GitHubTest/wiremock/getMeta/__files/1-meta.json b/src/test/resources/org/kohsuke/github/GitHubTest/wiremock/getMeta/__files/1-meta.json index 2baa8baf32..d66ad1746e 100644 --- a/src/test/resources/org/kohsuke/github/GitHubTest/wiremock/getMeta/__files/1-meta.json +++ b/src/test/resources/org/kohsuke/github/GitHubTest/wiremock/getMeta/__files/1-meta.json @@ -1,5 +1,16 @@ { "verifiable_password_authentication": true, + "ssh_key_fingerprints": { + "SHA256_RSA": 1234567890, + "SHA256_DSA": 1234567890, + "SHA256_ECDSA": 1234567890, + "SHA256_ED25519": 1234567890 + }, + "ssh_keys": [ + "ssh-ed25519 ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "ecdsa-sha2-nistp256 ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "ssh-rsa ABCDEFGHIJKLMNOPQRSTUVWXYZ" + ], "hooks": [ "192.30.252.0/22", "185.199.108.0/22",