-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZCS-2691 Create DataSource implementation for LinkedIn contacts via oAuth #44
base: develop
Are you sure you want to change the base?
Conversation
import com.zimbra.oauth.utilities.LdapConfiguration; | ||
|
||
/** | ||
* The FacebookContactsImport class.<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LinkedinContactsImport
Also missing this docblock header on the handler class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
AUTHENTICATE_URI("https://www.linkedin.com/oauth/v2/accessToken"), | ||
ACCESS_TOKEN("access_token"), | ||
EXPIRES_IN("expires_in") | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this on the line before for consistency with the project. Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ID("id"), | ||
FIRST_NAME("firstName"), | ||
LAST_NAME("lastName") | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ERROR_DESCRIPTION("error_description"), | ||
DEFAULT_ERROR("default_error"), | ||
SERVICE_ERROR_CODE("serviceErrorCode"), | ||
ERROR_MESSAGE("message"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this and error_description
a key? Move each of the response keys to the general LinkedInOAuth2Constants
Keep your error codes in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
// get zimbra mailbox | ||
final ZMailbox mailbox = getZimbraMailbox(oauthInfo.getZmAuthToken()); | ||
|
||
// store refreshToken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// store accessToken
May not be unreasonable to note that linkedin tokens are short-lived only
. But that could be left for the import implementation where a small change may be necessary in syncDatasource
to not set a polling time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// store accessToken
@@ -60,6 +60,21 @@ | |||
* @copyright Copyright © 2018 | |||
*/ | |||
public abstract class OAuth2Handler { | |||
// for relay encoding | |||
public enum RelayEnum { | |||
RELAY("relay"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constants already exist in the project.
https://github.com/Zimbra/zm-oauth-social/blob/develop/src/java/com/zimbra/oauth/utilities/OAuth2HttpConstants.java#L38
Also "relay" isn't used anymore since the tickets with the ds type updates - it's now "state" into the authorize call, and whatever the social service uses out to the social service (typically "state" - but configurable for each service), and same thing on return into authenticate (whatever the service uses).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this enum is not used anywhere, so removed. I added it while i was testing JweUtil to pass the relay values but i removed that part of code.
} | ||
|
||
@Override | ||
protected String getPrimaryEmail(JsonNode credentials, Account account) throws ServiceException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format all of this method's source (lines appear too long).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatted code
Don't merge this since we're putting linked aside for now. |
Problem/Task: create datasource implementation for Linkedin contacts sync using oAuth2
Fix:
<username>-contact-linkedin
, as profile call for linkedin needs "r_fullprofile" permission and this permission in given by linkedin on request. Request with linkedin support is raised.Testing done:
Testing needs to be done by QA:
Linked PR:
Zimbra/zm-mailbox#696