|
2 | 2 |
|
3 | 3 | import com.bhyoo.onedrive.client.auth.AbstractAuthHelper; |
4 | 4 | import com.bhyoo.onedrive.client.auth.AuthHelper; |
| 5 | +import com.bhyoo.onedrive.client.auth.AuthenticationInfo; |
5 | 6 | import com.bhyoo.onedrive.container.AsyncJobMonitor; |
6 | 7 | import com.bhyoo.onedrive.container.items.*; |
7 | 8 | import com.bhyoo.onedrive.container.items.pointer.BasePointer; |
|
25 | 26 | import java.nio.file.Files; |
26 | 27 | import java.nio.file.Path; |
27 | 28 | import java.nio.file.Paths; |
| 29 | +import java.util.Arrays; |
28 | 30 |
|
29 | 31 | import static com.bhyoo.onedrive.container.items.pointer.Operator.*; |
30 | 32 | import static io.netty.handler.codec.http.HttpMethod.GET; |
@@ -96,6 +98,30 @@ public Client(@NotNull String clientId, @NotNull String[] scope, @NotNull String |
96 | 98 | } |
97 | 99 |
|
98 | 100 |
|
| 101 | + /** |
| 102 | + * Constructor used when authorization is handled by an external system. In this case, the accessToken, |
| 103 | + * refreshToken and expiresIn values have been obtained elsewhere. |
| 104 | + * @param clientId The OAuth clientID |
| 105 | + * @param scope A {@link String[]} of scopes |
| 106 | + * @param redirectURL The OAuth redirect URL |
| 107 | + * @param clientSecret The OAuth clientSecret token |
| 108 | + * @param accessToken The OAuth accessToken |
| 109 | + * @param refreshToken The OAuth refreshToken |
| 110 | + * @param tokenType The OAuth tokenType |
| 111 | + * @param expiresIn The OAuth expiresIn value |
| 112 | + */ |
| 113 | + public Client(@NotNull String clientId, |
| 114 | + @NotNull String[] scope, |
| 115 | + @NotNull String redirectURL, |
| 116 | + @NotNull String clientSecret, |
| 117 | + @NotNull String accessToken, |
| 118 | + @NotNull String refreshToken, |
| 119 | + String tokenType, |
| 120 | + long expiresIn) { |
| 121 | + requestTool = new RequestTool(this); |
| 122 | + AuthenticationInfo authInfo = new AuthenticationInfo(tokenType, expiresIn, accessToken, refreshToken, Arrays.toString(scope)); |
| 123 | + authHelper = new AuthHelper(scope, clientId, clientSecret, redirectURL, requestTool, authInfo); |
| 124 | + } |
99 | 125 |
|
100 | 126 |
|
101 | 127 | /* |
|
0 commit comments