com.github.scribejava.apis.StackExchangeApi Maven / Gradle / Ivy
package com.github.scribejava.apis;
import com.github.scribejava.core.builder.api.DefaultApi20;
import com.github.scribejava.core.extractors.OAuth2AccessTokenExtractor;
import com.github.scribejava.core.extractors.TokenExtractor;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.oauth2.bearersignature.BearerSignature;
import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter;
/**
* Stack Exchange authentication via OAuth 2.0 (stackoverflow.com,
* askubuntu.com, etc.).
*/
public class StackExchangeApi extends DefaultApi20 {
protected StackExchangeApi() {
}
private static class InstanceHolder {
private static final StackExchangeApi INSTANCE = new StackExchangeApi();
}
public static StackExchangeApi instance() {
return InstanceHolder.INSTANCE;
}
@Override
public String getAccessTokenEndpoint() {
return "https://stackexchange.com/oauth/access_token";
}
@Override
protected String getAuthorizationBaseUrl() {
return "https://stackexchange.com/oauth";
}
@Override
public TokenExtractor getAccessTokenExtractor() {
return OAuth2AccessTokenExtractor.instance();
}
@Override
public BearerSignature getBearerSignature() {
return BearerSignatureURIQueryParameter.instance();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy