Commit 109efda98950e3ed8cedf68f80ec79717247c81a

Authored by Luís Pedro
1 parent 9b478d4257

New constructor added and methods refactor

src/main/java/org/um/dsi/gavea/orcid/client/OrcidOAuthClient.java
... ... @@ -2,6 +2,7 @@ package org.um.dsi.gavea.orcid.client;
2 2  
3 3 import java.util.List;
4 4  
  5 +import javax.ws.rs.client.Client;
5 6 import javax.ws.rs.client.Entity;
6 7 import javax.ws.rs.core.MediaType;
7 8 import javax.ws.rs.core.MultivaluedHashMap;
... ... @@ -47,9 +48,12 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
47 48 private static final Logger _log = LogManager.getLogger(OrcidOAuthClient.class);
48 49  
49 50 public OrcidOAuthClient(String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri) {
50   - super(loginUri, apiUri, clientId, clientSecret, redirectUri);
  51 + this(null, loginUri, apiUri, clientId, clientSecret, redirectUri);
51 52 }
52 53  
  54 + public OrcidOAuthClient(Client restClient, String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri) {
  55 + super(restClient, loginUri, apiUri, clientId, clientSecret, redirectUri);
  56 + }
53 57  
54 58 /**
55 59 *
... ... @@ -59,7 +63,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
59 63 * @return
60 64 * @throws Exception
61 65 */
62   - public String getAuthorizeUriLogin(final List<ScopePathType> scopes, final String state, final String orcidOrEmail) throws Exception {
  66 + public String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String orcidOrEmail) throws Exception {
63 67  
64 68 String orcidId = null;
65 69 String email = null;
... ... @@ -82,7 +86,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
82 86 * @return
83 87 * @throws Exception
84 88 */
85   - public String getAuthorizeUriRegistration(final List<ScopePathType> scopes, final String state, final String familyNames, final String givenNames) throws Exception {
  89 + public String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String familyNames, final String givenNames) throws Exception {
86 90 return getAuthorizeUri(scopes, state, null, familyNames, givenNames, null, null, false);
87 91 }
88 92  
... ... @@ -99,8 +103,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
99 103 * @return
100 104 * @throws Exception
101 105 */
102   - private String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String orcidId, final String familyNames, final String givenNames, final String email, final String lang,
103   - final boolean login) throws Exception {
  106 + private String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String orcidId, final String familyNames, final String givenNames, final String email, final String lang, final boolean login) throws Exception {
104 107  
105 108 if (scopes == null)
106 109 throw new Exception("Cannot create Authorize Uri - missing scopes");
... ...