-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip refresh GitHub tokens, override refresh Azure DevOps token request
- Loading branch information
Showing
5 changed files
with
203 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
...th-azure-devops/src/main/java/org/eclipse/che/security/oauth/AzureDevOpsRefreshToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright (c) 2012-2024 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.che.security.oauth; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Objects; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class AzureDevOpsRefreshToken { | ||
/** Access token issued by the authorization server. */ | ||
private String accessToken; | ||
|
||
/** Token type. */ | ||
private String tokenType; | ||
|
||
/** Refresh token which can be used to obtain new access tokens. */ | ||
private String refreshToken; | ||
|
||
/** | ||
* Lifetime in seconds of the access token (for example 3600 for an hour) or {@code null} for | ||
* none. | ||
*/ | ||
private String expiresInSeconds; | ||
|
||
/** Scope of the access token. */ | ||
private String scope; | ||
|
||
public String getAccessToken() { | ||
return accessToken; | ||
} | ||
|
||
public String getTokenType() { | ||
return tokenType; | ||
} | ||
|
||
public String getRefreshToken() { | ||
return refreshToken; | ||
} | ||
|
||
public String getScope() { | ||
return scope; | ||
} | ||
|
||
public String getExpiresInSeconds() { | ||
return expiresInSeconds; | ||
} | ||
|
||
@JsonProperty("access_token") | ||
public void setAccessToken(String accessToken) { | ||
this.accessToken = accessToken; | ||
} | ||
|
||
@JsonProperty("token_type") | ||
public void setTokenType(String tokenType) { | ||
this.tokenType = tokenType; | ||
} | ||
|
||
@JsonProperty("refresh_token") | ||
public void setRefreshToken(String refreshToken) { | ||
this.refreshToken = refreshToken; | ||
} | ||
|
||
@JsonProperty("expires_in") | ||
public void setExpiresInSeconds(String expiresInSeconds) { | ||
this.expiresInSeconds = expiresInSeconds; | ||
} | ||
|
||
public void setScope(String scope) { | ||
this.scope = scope; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AzureDevOpsRefreshToken{" | ||
+ "accessToken='" | ||
+ accessToken | ||
+ '\'' | ||
+ ", tokenType='" | ||
+ tokenType | ||
+ '\'' | ||
+ ", refreshToken='" | ||
+ refreshToken | ||
+ '\'' | ||
+ ", expiresInSeconds='" | ||
+ expiresInSeconds | ||
+ '\'' | ||
+ ", scope='" | ||
+ scope | ||
+ '\'' | ||
+ '}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
AzureDevOpsRefreshToken that = (AzureDevOpsRefreshToken) o; | ||
return Objects.equals(accessToken, that.accessToken) | ||
&& Objects.equals(tokenType, that.tokenType) | ||
&& Objects.equals(refreshToken, that.refreshToken) | ||
&& Objects.equals(expiresInSeconds, that.expiresInSeconds) | ||
&& Objects.equals(scope, that.scope); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(accessToken, tokenType, refreshToken, expiresInSeconds, scope); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters