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


Java AuthValidationException类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:25,代码来源:DryRunOAuthValidator.java

示例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);
    }
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:19,代码来源:AuthValidatorHelper.java

示例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);
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:NoOpAuthValidator.java

示例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;
    }
 
开发者ID:jivesoftware,项目名称:miru,代码行数:45,代码来源:MiruSyncOAuthValidatorInitializer.java

示例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;
    }
 
开发者ID:jivesoftware,项目名称:amza,代码行数:45,代码来源:AmzaSyncOAuthValidatorInitializer.java

示例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;
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:13,代码来源:AuthValidator.java


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