-
Notifications
You must be signed in to change notification settings - Fork 776
Expand file tree
/
Copy pathGHAuthorization.java
More file actions
179 lines (146 loc) · 4.23 KB
/
GHAuthorization.java
File metadata and controls
179 lines (146 loc) · 4.23 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
// TODO: Auto-generated Javadoc
/**
* Generated OAuth token.
*
* @author janinko
* @see GitHub#createToken(Collection, String, String) GitHub#createToken(Collection, String, String)
* @see <a href="http://developer.github.com/v3/oauth/#create-a-new-authorization">API documentation</a>
*/
public class GHAuthorization extends GHObject {
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
justification = "JSON API")
private static class App {
private String name;
// private String client_id; not yet used
private String url;
}
/** The Constant ADMIN_KEY. */
public static final String ADMIN_KEY = "admin:public_key";
/** The Constant ADMIN_ORG. */
public static final String ADMIN_ORG = "admin:org";
/** The Constant AMIN_HOOK. */
public static final String AMIN_HOOK = "admin:repo_hook";
/** The Constant DELETE_REPO. */
public static final String DELETE_REPO = "delete_repo";
/** The Constant GIST. */
public static final String GIST = "gist";
/** The Constant NOTIFICATIONS. */
public static final String NOTIFICATIONS = "notifications";
/** The Constant PUBLIC_REPO. */
public static final String PUBLIC_REPO = "public_repo";
/** The Constant READ_HOOK. */
public static final String READ_HOOK = "read:repo_hook";
/** The Constant READ_KEY. */
public static final String READ_KEY = "read:public_key";
/** The Constant READ_ORG. */
public static final String READ_ORG = "read:org";
/** The Constant REPO. */
public static final String REPO = "repo";
/** The Constant REPO_STATUS. */
public static final String REPO_STATUS = "repo:status";
/** The Constant USER. */
public static final String USER = "user";
/** The Constant USER_EMAIL. */
public static final String USER_EMAIL = "user:email";
/** The Constant USER_FOLLOW. */
public static final String USER_FOLLOW = "user:follow";
/** The Constant WRITE_HOOK. */
public static final String WRITE_HOOK = "write:repo_hook";
/** The Constant WRITE_KEY. */
public static final String WRITE_KEY = "write:public_key";
/** The Constant WRITE_ORG. */
public static final String WRITE_ORG = "write:org";
private App app;
private String fingerprint;
// TODO add some user class for https://developer.github.com/v3/oauth_authorizations/#check-an-authorization ?
// private GHUser user;
private String hashed_token;
private String note;
private String note_url;
private List<String> scopes;
private String token;
private String token_last_eight;
/**
* Create default GHAuthorization instance
*/
public GHAuthorization() {
}
/**
* Gets app name.
*
* @return the app name
*/
public String getAppName() {
return app.name;
}
/**
* Gets app url.
*
* @return the app url
*/
public URL getAppUrl() {
return GitHubClient.parseURL(app.url);
}
/**
* Gets fingerprint.
*
* @return the fingerprint
*/
public String getFingerprint() {
return fingerprint;
}
/**
* Gets hashed token.
*
* @return the hashed token
*/
public String getHashedToken() {
return hashed_token;
}
/**
* Gets note.
*
* @return the note
*/
public String getNote() {
return note;
}
/**
* Gets note url.
*
* @return the note url
*/
public URL getNoteUrl() {
return GitHubClient.parseURL(note_url);
}
/**
* Gets scopes.
*
* @return the scopes
*/
public List<String> getScopes() {
return Collections.unmodifiableList(scopes);
}
/**
* Gets token.
*
* @return the token
*/
public String getToken() {
return token;
}
/**
* Gets token last eight.
*
* @return the token last eight
*/
public String getTokenLastEight() {
return token_last_eight;
}
}