当前位置: 首页>>代码示例>>Java>>正文


Java MissingAuthorizationException类代码示例

本文整理汇总了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);
    }

}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:56,代码来源:TwitterErrorHandler.java

示例2: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization()
{
    if (!isAuthorized)
    {
        throw new MissingAuthorizationException("weibo");
    }
}
 
开发者ID:edwardluzi,项目名称:spring-social-wechat,代码行数:8,代码来源:AbstractTemplate.java

示例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");
	}
}
 
开发者ID:mornya,项目名称:spring-social-naver,代码行数:14,代码来源:UserOperationImpl.java

示例4: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization()
{
    if (!isAuthorized)
    {
        throw new MissingAuthorizationException();
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:AbstractFlickrOperations.java

示例5: requireUserAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireUserAuthorization() {
    if (!isUserAuthorized) {
        throw new MissingAuthorizationException(TWITTER);
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:6,代码来源:AbstractTwitterOperations.java

示例6: requireAppAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAppAuthorization() {
    if (!isAppAuthorized) {
        throw new MissingAuthorizationException(TWITTER);
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:6,代码来源:AbstractTwitterOperations.java

示例7: requireEitherUserOrAppAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireEitherUserOrAppAuthorization() {
    if (!isUserAuthorized && !isAppAuthorized) {
        throw new MissingAuthorizationException(TWITTER);
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:6,代码来源:AbstractTwitterOperations.java

示例8: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
    if (!isAuthorized) {
        throw new MissingAuthorizationException("discord");
    }
}
 
开发者ID:quanticc,项目名称:sentry,代码行数:6,代码来源:AbstractDiscordOperations.java

示例9: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
    if (!isAuthorized) {
        throw new MissingAuthorizationException("kakao");
    }
}
 
开发者ID:Hongchae,项目名称:spring-social-kakao,代码行数:6,代码来源:AbstractKakaoOperations.java

示例10: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
	if (!isAuthorized) {
		throw new MissingAuthorizationException("strava");
	}
}
 
开发者ID:pivotal,项目名称:spring-social-strava,代码行数:6,代码来源:AbstractStravaOperations.java

示例11: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
    if (!isAuthorized) {
        throw new MissingAuthorizationException("tencentWeibo");
    }
}
 
开发者ID:avidoggy,项目名称:spring-social-tencent-weibo,代码行数:6,代码来源:AbstractTencentWeiboOperations.java

示例12: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
	if (!isAuthorized) {
		throw new MissingAuthorizationException("auth0");
	}
}
 
开发者ID:cpitman,项目名称:spring-social-auth0,代码行数:6,代码来源:AbstractAuth0Operations.java

示例13: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
    if (!isAuthorized) {
        throw new MissingAuthorizationException("google");
    }
}
 
开发者ID:alyahmed,项目名称:spring-social-reddit,代码行数:6,代码来源:AbstractRedditOperations.java

示例14: requireAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
protected void requireAuthorization() {
	if (!isAuthorized) {
		throw new MissingAuthorizationException("meetup");
	}
}
 
开发者ID:yarli4u,项目名称:spring-social-meetup,代码行数:6,代码来源:AbstractMeetupOperations.java

示例15: checkAuthorization

import org.springframework.social.MissingAuthorizationException; //导入依赖的package包/类
public void checkAuthorization(boolean isAuthorized){
    if (!isAuthorized) {
        throw new MissingAuthorizationException(Box.BOX_PROVIDER_NAME);
    }
}
 
开发者ID:eSignLive,项目名称:spring-social-box,代码行数:6,代码来源:AbstractTemplate.java


注:本文中的org.springframework.social.MissingAuthorizationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。