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
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
#pike __REAL_VERSION__ 
 
//! Google authentication classes. 
 
//! Default Google authorization class 
//! For more info see @url{https://developers.google.com/+/web/api/rest/oauth@} 
class Authorization 
{ 
  inherit Web.Auth.OAuth2.Client; 
 
  //! 
  constant OAUTH_AUTH_URI  = "https://accounts.google.com/o/oauth2/auth"; 
 
  //! 
  constant OAUTH_TOKEN_URI = "https://accounts.google.com/o/oauth2/token"; 
 
  //! 
  constant SCOPE_PROFILE = "profile"; 
 
  //! 
  constant SCOPE_EMAIL = "email"; 
 
  //! 
  constant SCOPE_OPENID = "openid"; 
 
  //! All valid socpes 
  protected multiset(string) valid_scopes = (< 
    SCOPE_PROFILE, SCOPE_EMAIL, SCOPE_OPENID >); 
 
  protected string _scope = SCOPE_PROFILE; 
} 
 
//! Google Analytics authorization class 
class Analytics 
{ 
  inherit Authorization; 
 
  //! Authentication scopes 
  constant SCOPE_RO = "https://www.googleapis.com/auth/analytics.readonly"; 
  constant SCOPE_RW = "https://www.googleapis.com/auth/analytics"; 
  constant SCOPE_EDIT = "https://www.googleapis.com/auth/analytics.edit"; 
  constant SCOPE_MANAGE_USERS = 
    "https://www.googleapis.com/auth/analytics.manage.users"; 
  constant SCOPE_MANAGE_USERS_RO = 
    "https://www.googleapis.com/auth/analytics.manage.users.readonly"; 
 
  //! All valid scopes 
  protected multiset(string) valid_scopes = (< 
    SCOPE_RO, SCOPE_RW, SCOPE_EDIT, SCOPE_MANAGE_USERS, 
    SCOPE_MANAGE_USERS_RO >); 
 
  //! Default scope 
  protected string _scope = SCOPE_RO; 
} 
 
//! Google+ authorization class 
class Plus 
{ 
  inherit Authorization; 
 
  //! Authentication scopes 
  constant SCOPE_ME = "https://www.googleapis.com/auth/plus.me"; 
  constant SCOPE_LOGIN = "https://www.googleapis.com/auth/plus.login"; 
 
  //! All valid scopes 
  protected multiset(string) valid_scopes = (< 
    SCOPE_ME, SCOPE_LOGIN, SCOPE_EMAIL >); 
 
  //! Default scope 
  protected string _scope = SCOPE_ME; 
}