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


Java MalformedChallengeException类代码示例

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


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

示例1: testParsingChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
public void testParsingChallenge() {
    String challenge = 
      "Basic realm=\"realm1\", test, test1 =  stuff, test2 =  \"stuff, stuff\", test3=\"crap";
    String scheme = null;
    Map elements = null;
    try {
        scheme = AuthChallengeParser.extractScheme(challenge);
        elements = AuthChallengeParser.extractParams(challenge);
    } catch (MalformedChallengeException e) {
        fail("Unexpected exception: " + e.toString());
    }
    assertEquals("basic", scheme);
    assertEquals("realm1", elements.get("realm"));
    assertEquals(null, elements.get("test"));
    assertEquals("stuff", elements.get("test1"));
    assertEquals("stuff, stuff", elements.get("test2"));
    assertEquals("\"crap", elements.get("test3"));
}
 
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:19,代码来源:TestChallengeParser.java

示例2: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
/**
 * Processes the NTLM challenge.
 * 
 * @param challenge
 *            the challenge string
 * 
 * @throws MalformedChallengeException
 *             is thrown if the authentication challenge is malformed
 *
 * @since 3.0
 */
public void processChallenge(final String challenge)
throws MalformedChallengeException {
	String s = AuthChallengeParser.extractScheme(challenge);
	if (!s.equalsIgnoreCase(getSchemeName())) {
		throw new MalformedChallengeException("Invalid NTLM challenge: "
				+ challenge);
	}
	int i = challenge.indexOf(' ');
	if (i != -1) {
		s = challenge.substring(i, challenge.length());
		this.ntlmchallenge = s.trim();
		this.state = TYPE2_MSG_RECEIVED;
	} else {
		this.ntlmchallenge = "";
		if (this.state == UNINITIATED) {
			this.state = INITIATED;
		} else {
			this.state = FAILED;
		}
	}
}
 
开发者ID:sheymans,项目名称:todopl,代码行数:33,代码来源:EwsJCIFSNTLMScheme.java

示例3: parseChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
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:DovAmir,项目名称:httpclientAuthHelper,代码行数:17,代码来源:CustomNTLM2Scheme.java

示例4: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
/**
 * Processes the NTLM challenge.
 *
 * @param challenge
 *            the challenge string
 *
 * @throws MalformedChallengeException
 *             is thrown if the authentication challenge is malformed
 *
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
    String s = AuthChallengeParser.extractScheme(challenge);
    if (!s.equalsIgnoreCase(getSchemeName())) {
        throw new MalformedChallengeException("Invalid NTLM challenge: "
                + challenge);
    }

    int i = challenge.indexOf(' ');
    if (i != -1) {
        s = challenge.substring(i, challenge.length());
        this.ntlmchallenge = s.trim();
        this.state = TYPE2_MSG_RECEIVED;
    } else {
        this.ntlmchallenge = "";
        if (this.state == UNINITIATED) {
            this.state = INITIATED;
        } else {
            this.state = FAILED;
        }
    }

}
 
开发者ID:magneticmoon,项目名称:httpclient3-ntml,代码行数:34,代码来源:NTLMScheme.java

示例5: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
/**
 * Processes the Bearer challenge.
 *  
 * @param   challenge                   The challenge string
 * 
 * @throws MalformedChallengeException  Thrown if the authentication challenge is malformed
 */
public void processChallenge(String challenge) throws MalformedChallengeException {
    String s = AuthChallengeParser.extractScheme(challenge);
    if (!s.equalsIgnoreCase(getSchemeName())) {
        throw new MalformedChallengeException(
          "Invalid " + getSchemeName() + " challenge: " + challenge); 
    }
    mParams = AuthChallengeParser.extractParams(challenge);
    mComplete = true;
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:17,代码来源:BearerAuthScheme.java

示例6: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
public void processChallenge(String challenge)
        throws MalformedChallengeException {
    // Nothing to do here, this is not a challenge based
    // auth scheme.  See NTLMScheme for a good example.
}
 
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:6,代码来源:CustomAuthenticationExample.java

示例7: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
/**
 * Processes the given challenge token. Some authentication schemes
 * may involve multiple challenge-response exchanges. Such schemes must be able
 * to maintain the state information when dealing with sequential challenges
 *
 * @param authheader the challenge header
 *
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 */
public void processChallenge(final String authheader) throws MalformedChallengeException {
    if (authheader == null) {
        throw new IllegalArgumentException("Header may not be null");
    }
    //String authheader = header.getName();
    /* TEST
    if (authheader.equalsIgnoreCase(WWW_AUTH)) {
        this.challengeState = ChallengeState.TARGET;
    } else if (authheader.equalsIgnoreCase(PROXY_AUTH)) {
        this.challengeState = ChallengeState.PROXY;
    } else {
        throw new MalformedChallengeException("Unexpected header name: " + authheader);
    }     */

    CharArrayBuffer buffer;
    int pos;
   /* if (header instanceof FormattedHeader) {
        buffer = ((FormattedHeader) header).getBuffer();
        pos = ((FormattedHeader) header).getValuePos();
    } else {
        String s = header.getValue();  */
    String s = authheader;
    if (s == null) {
        throw new MalformedChallengeException("Header value is null");
    }
    buffer = new CharArrayBuffer(s.length());
    buffer.append(s);
    pos = 0;
    //}
    while (pos < buffer.length() && EncodingUtils.isWhitespace(buffer.charAt(pos))) {
        pos++;
    }
    int beginIndex = pos;
    while (pos < buffer.length() && !EncodingUtils.isWhitespace(buffer.charAt(pos))) {
        pos++;
    }
    int endIndex = pos;
    String s2 = buffer.substring(beginIndex, endIndex);
    if (!s2.equalsIgnoreCase(getSchemeName())) {
        throw new MalformedChallengeException("Invalid scheme identifier: " + s2);
    }

    parseChallenge(buffer, pos, buffer.length());
}
 
开发者ID:DovAmir,项目名称:httpclientAuthHelper,代码行数:55,代码来源:CustomNTLM2SchemeBase.java

示例8: parseChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
protected abstract void parseChallenge(
CharArrayBuffer buffer, int beginIndex, int endIndex) throws MalformedChallengeException;
 
开发者ID:DovAmir,项目名称:httpclientAuthHelper,代码行数:3,代码来源:CustomNTLM2SchemeBase.java

示例9: NTLMScheme

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
public NTLMScheme(final String challenge) throws MalformedChallengeException {
    super();
    processChallenge(challenge);
}
 
开发者ID:magneticmoon,项目名称:httpclient3-ntml,代码行数:5,代码来源:NTLMScheme.java

示例10: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
@Override
public void processChallenge(String challenge) throws MalformedChallengeException {
    super.processChallenge(challenge);
    this.rotate = true;
}
 
开发者ID:adamcin,项目名称:httpsig-java,代码行数:6,代码来源:Http3SignatureAuthScheme.java

示例11: BearerAuthScheme

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
/**
 * Constructor for the basic authentication scheme.
 * 
 * @param   challenge                       Authentication challenge
 * 
 * @throws  MalformedChallengeException     Thrown if the authentication challenge is malformed
 * 
 * @deprecated Use parameterless constructor and {@link AuthScheme#processChallenge(String)} method
 */
public BearerAuthScheme(final String challenge) throws MalformedChallengeException {
    processChallenge(challenge);
    mComplete = true;
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:14,代码来源:BearerAuthScheme.java

示例12: processChallenge

import org.apache.commons.httpclient.auth.MalformedChallengeException; //导入依赖的package包/类
/**

        * Processes the NTLM challenge.

        *

        * @param challenge

        *            the challenge string

        *

        * @throws MalformedChallengeException

        *             is thrown if the authentication challenge is malformed

        *

        * @since 3.0

        */

       public void processChallenge(final String challenge)

                     throws MalformedChallengeException {

              String s = AuthChallengeParser.extractScheme(challenge);

              if (!s.equalsIgnoreCase(getSchemeName())) {

                     throw new MalformedChallengeException("Invalid NTLM challenge: "

                                  + challenge);

              }

              int i = challenge.indexOf(' ');

              if (i != -1) {

                     s = challenge.substring(i, challenge.length());

                     this.ntlmchallenge = s.trim();

                     this.state = TYPE2_MSG_RECEIVED;

              } else {

                     this.ntlmchallenge = "";

                     if (this.state == UNINITIATED) {

                           this.state = INITIATED;

                     } else {

                           this.state = FAILED;

                     }

              }

       }
 
开发者ID:mendix,项目名称:RestServices,代码行数:64,代码来源:JCIFS_NTLMScheme.java


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