mirror of
https://github.com/tribufu/tribufu-java
synced 2026-05-06 14:57:27 +00:00
parent
68f92bca97
commit
4ba26d707d
10 changed files with 109 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.sdk;
|
||||
package com.tribufu;
|
||||
|
||||
import java.net.http.HttpClient;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public class OAuth2AuthorizeRequest {
|
||||
private final OAuth2ResponseType responseType;
|
||||
private final String clientId;
|
||||
private final String scope;
|
||||
private final String redirectUri;
|
||||
private final String state;
|
||||
|
||||
public OAuth2AuthorizeRequest(OAuth2ResponseType responseType, String clientId, String scope, String redirectUri,
|
||||
String state) {
|
||||
this.responseType = responseType;
|
||||
this.clientId = clientId;
|
||||
this.scope = scope;
|
||||
this.redirectUri = redirectUri;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
13
lib/src/main/java/com/tribufu/oauth2/OAuth2CodeResponse.java
Normal file
13
lib/src/main/java/com/tribufu/oauth2/OAuth2CodeResponse.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public class OAuth2CodeResponse {
|
||||
public final String code;
|
||||
public final String state;
|
||||
|
||||
public OAuth2CodeResponse(String code, String state) {
|
||||
this.code = code;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
11
lib/src/main/java/com/tribufu/oauth2/OAuth2GrantType.java
Normal file
11
lib/src/main/java/com/tribufu/oauth2/OAuth2GrantType.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public enum OAuth2GrantType {
|
||||
AuthorizationCode,
|
||||
RefreshToken,
|
||||
Password,
|
||||
ClientCredentials,
|
||||
DeviceCode,
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public enum OAuth2ResponseType {
|
||||
Code,
|
||||
Token,
|
||||
}
|
||||
26
lib/src/main/java/com/tribufu/oauth2/OAuth2TokenRequest.java
Normal file
26
lib/src/main/java/com/tribufu/oauth2/OAuth2TokenRequest.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public class OAuth2TokenRequest {
|
||||
private final OAuth2GrantType grantType;
|
||||
private final String code;
|
||||
private final String refreshToken;
|
||||
private final String username;
|
||||
private final String password;
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final String redirectUri;
|
||||
|
||||
public OAuth2TokenRequest(OAuth2GrantType grantType, String code, String refreshToken, String username,
|
||||
String password, String clientId, String clientSecret, String redirectUri) {
|
||||
this.grantType = grantType;
|
||||
this.code = code;
|
||||
this.refreshToken = refreshToken;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.clientId = clientId;
|
||||
this.clientSecret = clientSecret;
|
||||
this.redirectUri = redirectUri;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public class OAuth2TokenResponse {
|
||||
private final OAuth2TokenType tokenType;
|
||||
private final String accessToken;
|
||||
private final String refreshToken;
|
||||
private final String scope;
|
||||
private final int expiresIn;
|
||||
|
||||
public OAuth2TokenResponse(OAuth2TokenType tokenType, String accessToken, String refreshToken, String scope,
|
||||
int expiresIn) {
|
||||
this.tokenType = tokenType;
|
||||
this.accessToken = accessToken;
|
||||
this.refreshToken = refreshToken;
|
||||
this.scope = scope;
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.oauth2;
|
||||
|
||||
public enum OAuth2TokenType {
|
||||
Bearer,
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
// Copyright (c) Tribufu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk;
|
||||
package com.tribufu;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
Loading…
Add table
Add a link
Reference in a new issue