本文整理汇总了Java中org.springframework.social.MissingAuthorizationException类的典型用法代码示例。如果您正苦于以下问题:Java MissingAuthorizationException类的具体用法?Java MissingAuthorizationException怎么用?Java MissingAuthorizationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MissingAuthorizationException类属于org.springframework.social包,在下文中一共展示了MissingAuthorizationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleClientErrors
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
private static void handleClientErrors(ClientHttpResponse response) throws IOException {
HttpStatus statusCode = response.getStatusCode();
Map<String, Object> errorMap = extractErrorDetailsFromResponse(response);
String errorText = "";
if (errorMap.containsKey("error")) {
errorText = (String) errorMap.get("error");
} else if (errorMap.containsKey("errors")) {
Object errors = errorMap.get("errors");
if (errors instanceof List) {
@SuppressWarnings("unchecked")
List<Map<String, String>> errorsList = (List<Map<String, String>>) errors;
errorText = errorsList.get(0).get("message");
} else if (errors instanceof String) {
errorText = (String) errors;
}
}
if (statusCode == HttpStatus.BAD_REQUEST) {
if (errorText.contains("Rate limit exceeded.")) {
throw new RateLimitExceededException(TWITTER);
}
} else if (statusCode == HttpStatus.UNAUTHORIZED) {
if (errorText == null) {
throw new NotAuthorizedException(TWITTER, response.getStatusText());
} else if ("Could not authenticate you.".equals(errorText)) {
throw new MissingAuthorizationException(TWITTER);
} else if ("Could not authenticate with OAuth.".equals(errorText)) { // revoked token
throw new RevokedAuthorizationException(TWITTER);
} else if ("Invalid / expired Token".equals(errorText)) {
// Note that Twitter doesn't actually expire tokens
throw new InvalidAuthorizationException(TWITTER, errorText);
} else {
throw new NotAuthorizedException(TWITTER, errorText);
}
} else if (statusCode == HttpStatus.FORBIDDEN) {
if (errorText.equals(DUPLICATE_STATUS_TEXT) || errorText.contains("You already said that")) {
throw new DuplicateStatusException(TWITTER, errorText);
} else if (errorText.equals(STATUS_TOO_LONG_TEXT) || errorText.contains(MESSAGE_TOO_LONG_TEXT)) {
throw new MessageTooLongException(errorText);
} else if (errorText.equals(INVALID_MESSAGE_RECIPIENT_TEXT)) {
throw new InvalidMessageRecipientException(errorText);
} else if (errorText.equals(DAILY_RATE_LIMIT_TEXT)) {
throw new RateLimitExceededException(TWITTER);
} else {
throw new OperationNotPermittedException(TWITTER, errorText);
}
} else if (statusCode == HttpStatus.NOT_FOUND) {
throw new ResourceNotFoundException(TWITTER, errorText);
} else if (statusCode == HttpStatus.valueOf(ENHANCE_YOUR_CALM) || statusCode == HttpStatus
.valueOf(TOO_MANY_REQUESTS)) {
throw new RateLimitExceededException(TWITTER);
}
}
示例2: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization()
{
if (!isAuthorized)
{
throw new MissingAuthorizationException("weibo");
}
}
示例3: getUserProfile
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
private UserProfileResponse getUserProfile() {
if (this.isAuthorized) {
if (!"00".equals(this.userProfile.getResult().getResultcode())) {
throw new InvalidAuthorizationException("naver", this.userProfile.getResult().getMessage());
}
if (LOG.isDebugEnabled()) {
LOG.debug("USER PROFILE RESULT: {}", this.userProfile.toJson(false));
}
return this.userProfile.getResponse();
} else {
throw new MissingAuthorizationException("naver");
}
}
示例4: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization()
{
if (!isAuthorized)
{
throw new MissingAuthorizationException();
}
}
示例5: requireUserAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireUserAuthorization() {
if (!isUserAuthorized) {
throw new MissingAuthorizationException(TWITTER);
}
}
示例6: requireAppAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAppAuthorization() {
if (!isAppAuthorized) {
throw new MissingAuthorizationException(TWITTER);
}
}
示例7: requireEitherUserOrAppAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireEitherUserOrAppAuthorization() {
if (!isUserAuthorized && !isAppAuthorized) {
throw new MissingAuthorizationException(TWITTER);
}
}
示例8: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("discord");
}
}
示例9: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("kakao");
}
}
示例10: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("strava");
}
}
示例11: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("tencentWeibo");
}
}
示例12: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("auth0");
}
}
示例13: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("google");
}
}
示例14: requireAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("meetup");
}
}
示例15: checkAuthorization
import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
public void checkAuthorization(boolean isAuthorized){
if (!isAuthorized) {
throw new MissingAuthorizationException(Box.BOX_PROVIDER_NAME);
}
}