|
30 | 30 |
|
31 | 31 | import java.io.IOException; |
32 | 32 | import java.security.SecureRandom; |
33 | | -import java.util.*; |
| 33 | +import java.util.Base64; |
| 34 | +import java.util.HashMap; |
| 35 | +import java.util.Locale; |
| 36 | +import java.util.Map; |
34 | 37 | import java.util.concurrent.CompletableFuture; |
35 | 38 | import java.util.concurrent.ExecutionException; |
36 | 39 |
|
@@ -172,6 +175,7 @@ public void close() { |
172 | 175 |
|
173 | 176 | public static class Factory implements OAuth.Callback { |
174 | 177 | public final EventManager<GrantDeviceCodeEvent> onGrantDeviceCode = new EventManager<>(); |
| 178 | + public final EventManager<LoginCompletedDeviceCodeEvent> onLoginCompletedDeviceCode = new EventManager<>(); |
175 | 179 | public final EventManager<OpenBrowserEvent> onOpenBrowserAuthorizationCode = new EventManager<>(); |
176 | 180 | public final EventManager<OpenBrowserEvent> onOpenBrowserDevice = new EventManager<>(); |
177 | 181 |
|
@@ -199,6 +203,11 @@ public void grantDeviceCode(String userCode, String verificationURI) { |
199 | 203 | onGrantDeviceCode.fireEvent(new GrantDeviceCodeEvent(this, userCode, verificationURI)); |
200 | 204 | } |
201 | 205 |
|
| 206 | + @Override |
| 207 | + public void loginCompletedDeviceCode() { |
| 208 | + onLoginCompletedDeviceCode.fireEvent(new LoginCompletedDeviceCodeEvent(this)); |
| 209 | + } |
| 210 | + |
202 | 211 | @Override |
203 | 212 | public void openBrowser(OAuth.GrantFlow grantFlow, String url) throws IOException { |
204 | 213 | lastlyOpenedURL = url; |
@@ -235,6 +244,12 @@ public String getVerificationUri() { |
235 | 244 | } |
236 | 245 | } |
237 | 246 |
|
| 247 | + public static class LoginCompletedDeviceCodeEvent extends Event { |
| 248 | + public LoginCompletedDeviceCodeEvent(Object source) { |
| 249 | + super(source); |
| 250 | + } |
| 251 | + } |
| 252 | + |
238 | 253 | public static class OpenBrowserEvent extends Event { |
239 | 254 | private final String url; |
240 | 255 |
|
|
0 commit comments