1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
/* 
  Author: Pontus Östlund <https://profiles.google.com/poppanator> 
 
  Permission to copy, modify, and distribute this source for any legal 
  purpose granted as long as my name is still attached to it. More 
  specifically, the GPL, LGPL and MPL licenses apply to this software. 
*/ 
 
//! This class is used to OAuth2 authenticate against LinkedIn 
 
inherit Auth.OAuth2.Client; 
 
//! @ignore 
constant ACCESS_TOKEN_PARAM_NAME = "oauth2_access_token"; 
//! @endignore 
 
constant OAUTH_AUTH_URI = "https://www.linkedin.com/uas/oauth2/authorization"; 
constant OAUTH_TOKEN_URI = "https://www.linkedin.com/uas/oauth2/accessToken"; 
 
//! Adds the @tt{state@} parameter to the request which will have the value 
//! of a random string 
protected constant STATE = 1; 
 
//! Default scope to use if none is set explicitly 
protected constant DEFAULT_SCOPE = SCOPE_R_BASIC; 
 
enum Scopes { 
  SCOPE_R_BASIC        = "r_basicprofile", 
  SCOPE_R_NETWORK      = "r_network", 
  SCOPE_RW_GROUPS      = "rw_groups", 
  SCOPE_R_FULLPROFILE  = "r_fullprofile", 
  SCOPE_R_CONTACTINFO  = "r_contactinfo", 
  SCOPE_W_MESSAGES     = "w_messages", 
  SCOPE_R_EMAILADDRESS = "r_emailaddress", 
  SCOPE_RW_NUS         = "rw_nus" 
}; 
 
protected multiset(string) valid_scopes = (< 
  SCOPE_R_BASIC, 
  SCOPE_R_NETWORK, 
  SCOPE_RW_GROUPS, 
  SCOPE_R_FULLPROFILE, 
  SCOPE_R_CONTACTINFO, 
  SCOPE_W_MESSAGES, 
  SCOPE_R_EMAILADDRESS, 
  SCOPE_RW_NUS >); 
 
protected string _scope = SCOPE_R_BASIC;