• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MalformedChallengeException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExpiresHeader类代码示例发布时间:2022-05-22
下一篇:
Java Brew类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap