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


Java MalformedChallengeException类代码示例

本文整理汇总了Java中org.apache.http.auth.MalformedChallengeException的典型用法代码示例。如果您正苦于以下问题:Java MalformedChallengeException类的具体用法?Java MalformedChallengeException怎么用?Java MalformedChallengeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MalformedChallengeException类属于org.apache.http.auth包,在下文中一共展示了MalformedChallengeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
                               final CharArrayBuffer buffer,
                               int beginIndex,
                               int endIndex ) throws MalformedChallengeException {

    String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (log.isDebugEnabled()) {
        log.debug("Received challenge '" + challenge + "' from the auth server");
    }
    if (state == State.UNINITIATED) {
        token = base64codec.decode(challenge.getBytes());
        state = State.CHALLENGE_RECEIVED;
    } else {
        log.debug("Authentication already attempted");
        state = State.FAILED;
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:19,代码来源:GGSSchemeBase.java

示例2: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        int beginIndex, int endIndex) throws MalformedChallengeException {
    String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (challenge.length() == 0) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
        this.challenge = null;
    } else {
        this.state = State.MSG_TYPE2_RECEVIED;
        this.challenge = challenge;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:NTLMScheme.java

示例3: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        int beginIndex, int endIndex) throws MalformedChallengeException {
    String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (log.isDebugEnabled()) {
        log.debug("Received challenge '" + challenge + "' from the auth server");
    }
    if (state == State.UNINITIATED) {
        token = base64codec.decode(challenge.getBytes());
        state = State.CHALLENGE_RECEIVED;
    } else {
        log.debug("Authentication already attempted");
        state = State.FAILED;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:GGSSchemeBase.java

示例4: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex, final int endIndex) throws MalformedChallengeException {
    this.challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (this.challenge.length() == 0) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
    } else {
        if (this.state.compareTo(State.MSG_TYPE1_GENERATED) < 0) {
            this.state = State.FAILED;
            throw new MalformedChallengeException("Out of sequence NTLM response message");
        } else if (this.state == State.MSG_TYPE1_GENERATED) {
            this.state = State.MSG_TYPE2_RECEVIED;
        }
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:21,代码来源:NTLMSchemeHC4.java

示例5: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex, final int endIndex) throws MalformedChallengeException {
    this.challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (this.challenge.isEmpty()) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
    } else {
        if (this.state.compareTo(State.MSG_TYPE1_GENERATED) < 0) {
            this.state = State.FAILED;
            throw new MalformedChallengeException("Out of sequence NTLM response message");
        } else if (this.state == State.MSG_TYPE1_GENERATED) {
            this.state = State.MSG_TYPE2_RECEVIED;
        }
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:21,代码来源:NTLMScheme.java

示例6: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex, final int endIndex) throws MalformedChallengeException {
    final String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (log.isDebugEnabled()) {
        log.debug("Received challenge '" + challenge + "' from the auth server");
    }
    if (state == State.UNINITIATED) {
        token = Base64.decodeBase64(challenge.getBytes());
        state = State.CHALLENGE_RECEIVED;
    } else {
        log.debug("Authentication already attempted");
        state = State.FAILED;
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:17,代码来源:GGSSchemeBase.java

示例7: testAuthenticationException

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Test
public void testAuthenticationException() throws Exception {
    final HttpHost host = new HttpHost("somehost", 80);
    final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");

    this.authState.setState(AuthProtocolState.CHALLENGED);

    Mockito.doThrow(new MalformedChallengeException()).when(this.defltAuthStrategy).getChallenges(
            Mockito.any(HttpHost.class),
            Mockito.any(HttpResponse.class),
            Mockito.any(HttpContext.class));

    Assert.assertFalse(this.httpAuthenticator.handleAuthChallenge(host,
            response, this.defltAuthStrategy, this.authState, this.context));

    Assert.assertEquals(AuthProtocolState.UNCHALLENGED, this.authState.getState());
    Assert.assertNull(this.authState.getAuthScheme());
    Assert.assertNull(this.authState.getCredentials());
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:20,代码来源:TestHttpAuthenticator.java

示例8: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex,
        final int endIndex) throws MalformedChallengeException {
    this.challenge = buffer.substringTrimmed(beginIndex, endIndex);

    if (this.challenge.isEmpty()) {
        if (clientCred != null) {
            dispose(); // run cleanup first before throwing an exception otherwise can leak OS resources
            if (continueNeeded) {
                throw new RuntimeException("Unexpected token");
            }
        }
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:17,代码来源:WindowsNegotiateScheme.java

示例9: select

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
public Queue<AuthOption> select(final Map<String, Header> challengeHeaders,
                                final HttpHost authhost,
                                final HttpResponse response,
                                final HttpContext context)
        throws MalformedChallengeException {
    final HttpClientContext httpClientContext = HttpClientContext.adapt(context);
    final AuthState state = httpClientContext.getTargetAuthState();
    final Queue<AuthOption> queue = new LinkedList<>();

    if (state == null || !state.getState().equals(AuthProtocolState.CHALLENGED)) {
        queue.add(authOption);
    } else {
        System.out.println("does this happen?");
    }

    return queue;
}
 
开发者ID:joyent,项目名称:java-http-signature,代码行数:19,代码来源:HttpSignatureAuthenticationStrategy.java

示例10: processChallenges

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
private void processChallenges(
    final Map<String, Header> challenges,
    final AuthState authState,
    final AuthenticationHandler authHandler,
    final HttpResponse response,
    final HttpContext context)
      throws MalformedChallengeException, AuthenticationException {

  AuthScheme authScheme = authState.getAuthScheme();
  if (authScheme == null) {
    // Authentication not attempted before
    authScheme = authHandler.selectScheme(challenges, response, context);
    authState.setAuthScheme(authScheme);
  }
  String id = authScheme.getSchemeName();

  Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
  if (challenge == null) {
    throw new AuthenticationException(id +
      " authorization challenge expected, but not found");
  }
  authScheme.processChallenge(challenge);
  this.log.debug("Authorization challenge processed");
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:25,代码来源:DefaultRequestDirector.java

示例11: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer, int pos, int len) throws MalformedChallengeException {
    String challenge = buffer.substringTrimmed(pos, len);
    if (challenge.length() == 0) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
        this.challenge = null;
    } else {
        this.state = State.MSG_TYPE2_RECEVIED;
        this.challenge = challenge;
    }
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:17,代码来源:NTLMScheme.java

示例12: processChallenges

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
private void processChallenges(
        final Map<String, Header> challenges, 
        final AuthState authState,
        final AuthenticationHandler authHandler,
        final HttpResponse response, 
        final HttpContext context) 
            throws MalformedChallengeException, AuthenticationException {
    
    AuthScheme authScheme = authState.getAuthScheme();
    if (authScheme == null) {
        // Authentication not attempted before
        authScheme = authHandler.selectScheme(challenges, response, context);
        authState.setAuthScheme(authScheme);
    }
    String id = authScheme.getSchemeName();

    Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
    if (challenge == null) {
        throw new AuthenticationException(id + 
            " authorization challenge expected, but not found");
    }
    authScheme.processChallenge(challenge);
    this.log.debug("Authorization challenge processed");
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:25,代码来源:DefaultRequestDirector.java

示例13: processChallenges

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
private void processChallenges(
        final Map<String, Header> challenges,
        final AuthState authState,
        final AuthenticationHandler authHandler,
        final HttpResponse response,
        final HttpContext context)
            throws MalformedChallengeException, AuthenticationException {

    AuthScheme authScheme = authState.getAuthScheme();
    if (authScheme == null) {
        // Authentication not attempted before
        authScheme = authHandler.selectScheme(challenges, response, context);
        authState.setAuthScheme(authScheme);
    }
    String id = authScheme.getSchemeName();

    Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
    if (challenge == null) {
        throw new AuthenticationException(id +
            " authorization challenge expected, but not found");
    }
    authScheme.processChallenge(challenge);
    if (DEBUG) {
    	Logger.debug("Authorization challenge processed");
    }
}
 
开发者ID:cattong,项目名称:YiBo,代码行数:27,代码来源:LibRequestDirector.java

示例14: processChallenges

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
private void processChallenges(
        final Map<String, Header> challenges,
        final AuthState authState,
        final AuthenticationHandler authHandler,
        final HttpResponse response,
        final HttpContext context)
            throws MalformedChallengeException, AuthenticationException {

    AuthScheme authScheme = authState.getAuthScheme();
    if (authScheme == null) {
        // Authentication not attempted before
        authScheme = authHandler.selectScheme(challenges, response, context);
        authState.setAuthScheme(authScheme);
    }
    String id = authScheme.getSchemeName();

    Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
    if (challenge == null) {
        throw new AuthenticationException(id +
            " authorization challenge expected, but not found");
    }
    authScheme.processChallenge(challenge);
    if (Constants.DEBUG) {
    	logger.debug("Authorization challenge processed");
    }
}
 
开发者ID:yibome,项目名称:yibo-library,代码行数:27,代码来源:YiBoRequestDirector.java

示例15: parseChallenge

import org.apache.http.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer, int pos, int len) throws MalformedChallengeException {
    HeaderValueParser parser = BasicHeaderValueParser.DEFAULT;
    ParserCursor cursor = new ParserCursor(pos, buffer.length());
    HeaderElement[] elements = parser.parseElements(buffer, cursor);
    if (elements.length == 0) {
        throw new MalformedChallengeException("Authentication challenge is empty");
    }
    this.params.clear();
    for (HeaderElement element : elements) {
        this.params.put(element.getName(), element.getValue());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:RFC2617Scheme.java


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