本文整理汇总了Java中com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException类的典型用法代码示例。如果您正苦于以下问题:Java AuthValidationException类的具体用法?Java AuthValidationException怎么用?Java AuthValidationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthValidationException类属于com.jivesoftware.os.routing.bird.server.oauth包,在下文中一共展示了AuthValidationException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValid
import com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException; //导入依赖的package包/类
@Override
public AuthValidationResult isValid(OAuth1Signature verifier, OAuth1Request request) throws AuthValidationException {
OAuth1Parameters params = new OAuth1Parameters();
params.readRequest(request);
String consumerKey = params.getConsumerKey();
try {
AuthValidationResult result = authValidator.isValid(verifier, request);
if (result.authorized) {
LOG.info("Dry run validation passed for consumerKey:{}", consumerKey);
return result;
} else {
LOG.info("Dry run validation failed for consumerKey:{}", consumerKey);
return new AuthValidationResult(consumerKey, true);
}
} catch (AuthValidationException x) {
if (LOG.isDebugEnabled()) {
LOG.debug("Dry run validation failed for consumerKey:{}", new Object[]{consumerKey}, x);
} else {
LOG.warn("Dry run validation failed for consumerKey:{}", consumerKey);
}
return new AuthValidationResult(consumerKey, true);
}
}
示例2: isValid
import com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException; //导入依赖的package包/类
public static <V, R> AuthValidationResult isValid(AuthValidator<V, R> authValidator, V verifier, R request) {
try {
AuthValidationResult result = authValidator.isValid(verifier, request);
if (result != null && result.authorized) {
LOG.trace("Protocol and OAuth signature verification passed for verifier:{} request:{}",
verifier, request);
return result;
} else {
LOG.warn("Protocol signature passed but OAuth signature did not pass for verifier:{} request:{}",
verifier, request);
return result;
}
} catch (AuthValidationException ex) {
LOG.warn("Protocol signature did not pass, OAuth signature not attempted for verifier:{} request:{} protocol error:{}",
verifier, request, ex.toString());
return new AuthValidationResult(null, false);
}
}
示例3: isValid
import com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException; //导入依赖的package包/类
@Override
public AuthValidationResult isValid(V verifier, R request) throws AuthValidationException {
return new AuthValidationResult(null, true);
}
示例4: initialize
import com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException; //导入依赖的package包/类
public AuthValidator<OAuth1Signature, OAuth1Request> initialize(MiruSyncOAuthValidatorConfig config) throws Exception {
if (!config.getOauthValidatorIsEnabled()) {
return (AuthValidator) NoOpAuthValidator.SINGLETON;
}
Map<String, String> consumerKeyTokens = Maps.newConcurrentMap();
String tuples = config.getOauthConsumerKeyTokenTuples();
if (StringUtils.isNotBlank(tuples)) {
String[] keyTokenPairs = tuples.trim().split("\\s*,\\s*");
for (String pair : keyTokenPairs) {
String[] parts = pair.trim().split(":");
consumerKeyTokens.put(parts[0], parts[1]);
}
}
OAuthSecretManager authSecretManager = new OAuthSecretManager() {
@Override
public void clearCache() {
}
@Override
public String getSecret(String s) throws AuthValidationException {
return consumerKeyTokens.get(s);
}
@Override
public void verifyLastSecretRemovalTime() throws Exception {
}
};
AuthValidator<OAuth1Signature, OAuth1Request> oAuthValidator = new DefaultOAuthValidator(Executors.newScheduledThreadPool(1),
TimeUnit.DAYS.toMillis(1),
authSecretManager,
config.getOauthValidatorRequestTimestampAgeLimitMillis(),
config.getOauthValidatorLoadBalancerRejiggeringEnabled(),
config.getOauthValidatorLoadBalancerPortRejiggeringEnabled());
if (config.getOauthValidatorIsDryRun()) {
oAuthValidator = new DryRunOAuthValidator(oAuthValidator);
}
return oAuthValidator;
}
示例5: initialize
import com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException; //导入依赖的package包/类
public AuthValidator<OAuth1Signature, OAuth1Request> initialize(AmzaSyncOAuthValidatorConfig config) throws Exception {
if (!config.getOauthValidatorIsEnabled()) {
return (AuthValidator) NoOpAuthValidator.SINGLETON;
}
Map<String, String> consumerKeyTokens = Maps.newConcurrentMap();
String tuples = config.getOauthConsumerKeyTokenTuples();
if (StringUtils.isNotBlank(tuples)) {
String[] keyTokenPairs = tuples.trim().split("\\s*,\\s*");
for (String pair : keyTokenPairs) {
String[] parts = pair.trim().split(":");
consumerKeyTokens.put(parts[0], parts[1]);
}
}
OAuthSecretManager authSecretManager = new OAuthSecretManager() {
@Override
public void clearCache() {
}
@Override
public String getSecret(String s) throws AuthValidationException {
return consumerKeyTokens.get(s);
}
@Override
public void verifyLastSecretRemovalTime() throws Exception {
}
};
AuthValidator<OAuth1Signature, OAuth1Request> oAuthValidator = new DefaultOAuthValidator(Executors.newScheduledThreadPool(1),
TimeUnit.DAYS.toMillis(1),
authSecretManager,
config.getOauthValidatorRequestTimestampAgeLimitMillis(),
config.getOauthValidatorLoadBalancerRejiggeringEnabled(),
config.getOauthValidatorLoadBalancerPortRejiggeringEnabled());
if (config.getOauthValidatorIsDryRun()) {
oAuthValidator = new DryRunOAuthValidator(oAuthValidator);
}
return oAuthValidator;
}
示例6: isValid
import com.jivesoftware.os.routing.bird.server.oauth.AuthValidationException; //导入依赖的package包/类
/**
* @param verifier
* @param request
* @return the consumerKey if oauth signature verification was applied and passed, null if it was applied and did not pass
* @throws AuthValidationException on signature verification not passing for any reason different than the oauth library rejecting it.
* TODO Interface contract revision: there is no good reason for signature verification failure to be communicated
* in two different ways. If the exception was used to provide richer context through its message, then this method
* should return an object indicating success or failure and the useful part of the exception message, instead of
* the exception propagating the full stack trace that is worthless here.
* The verification failures that currently throw are really not "exceptional" circumstances.
*/
AuthValidationResult isValid(V verifier, R request) throws AuthValidationException;