-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update OAuth2 scribe dependency to the new scribejava (#900)
- Loading branch information
Showing
7 changed files
with
47 additions
and
96 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
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
32 changes: 12 additions & 20 deletions
32
src/main/java/com/cloudbees/jenkins/plugins/bitbucket/api/credentials/BitbucketOAuth.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 |
---|---|---|
@@ -1,37 +1,29 @@ | ||
package com.cloudbees.jenkins.plugins.bitbucket.api.credentials; | ||
|
||
import org.scribe.builder.api.DefaultApi20; | ||
import org.scribe.extractors.AccessTokenExtractor; | ||
import org.scribe.extractors.JsonTokenExtractor; | ||
import org.scribe.model.OAuthConfig; | ||
import org.scribe.model.Verb; | ||
import org.scribe.oauth.OAuthService; | ||
import com.github.scribejava.core.builder.api.DefaultApi20; | ||
|
||
public class BitbucketOAuth extends DefaultApi20 { | ||
public static final String OAUTH_ENDPOINT = "https://bitbucket.org/site/oauth2/"; | ||
private static final String OAUTH_ENDPOINT = "https://bitbucket.org/site/oauth2/"; | ||
|
||
@Override | ||
public String getAccessTokenEndpoint() { | ||
return OAUTH_ENDPOINT + "access_token"; | ||
protected BitbucketOAuth() { | ||
} | ||
|
||
@Override | ||
public String getAuthorizationUrl(OAuthConfig config) { | ||
return OAUTH_ENDPOINT + "authorize"; | ||
private static class InstanceHolder { | ||
private static final BitbucketOAuth INSTANCE = new BitbucketOAuth(); | ||
} | ||
|
||
@Override | ||
public Verb getAccessTokenVerb() { | ||
return Verb.POST; | ||
public static BitbucketOAuth instance() { | ||
return InstanceHolder.INSTANCE; | ||
} | ||
|
||
@Override | ||
public AccessTokenExtractor getAccessTokenExtractor() { | ||
return new JsonTokenExtractor(); | ||
public String getAccessTokenEndpoint() { | ||
return OAUTH_ENDPOINT + "access_token"; | ||
} | ||
|
||
@Override | ||
public OAuthService createService(OAuthConfig config) { | ||
return new BitbucketOAuthService(this, config); | ||
protected String getAuthorizationBaseUrl() { | ||
return OAUTH_ENDPOINT + "authorize"; | ||
} | ||
|
||
} |
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
52 changes: 0 additions & 52 deletions
52
...n/java/com/cloudbees/jenkins/plugins/bitbucket/api/credentials/BitbucketOAuthService.java
This file was deleted.
Oops, something went wrong.