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


Java ParameterList.hasParameter方法代码示例

本文整理汇总了Java中org.openid4java.message.ParameterList.hasParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterList.hasParameter方法的具体用法?Java ParameterList.hasParameter怎么用?Java ParameterList.hasParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openid4java.message.ParameterList的用法示例。


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

示例1: getAssociationResponse

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
/**
 * Gets the association response. Determines the mode first.
 * If mode is set to associate, will set the response. Then
 * builds the response parameters next and returns.
 *
 * @param request the request
 * @return the association response
 */
public Map<String, String> getAssociationResponse(final HttpServletRequest request) {
    final ParameterList parameters = new ParameterList(request.getParameterMap());

    final String mode = parameters.hasParameter(OpenIdProtocolConstants.OPENID_MODE)
            ? parameters.getParameterValue(OpenIdProtocolConstants.OPENID_MODE)
            : null;

    Message response = null;

    if (StringUtils.equals(mode, OpenIdProtocolConstants.ASSOCIATE)) {
        response = serverManager.associationResponse(parameters);
    }
    final Map<String, String> responseParams = new HashMap<>();
    if (response != null) {
        responseParams.putAll(response.getParameterMap());
    }

    return responseParams;

}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:29,代码来源:SmartOpenIdController.java

示例2: getAssociationResponse

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
/**
 * Gets the association response. Determines the mode first.
 * If mode is set to associate, will set the response. Then
 * builds the response parameters next and returns.
 *
 * @param request the request
 * @return the association response
 */
public Map<String, String> getAssociationResponse(final HttpServletRequest request) {
    final ParameterList parameters = new ParameterList(request.getParameterMap());

    final String mode = parameters.hasParameter(OpenIdConstants.OPENID_MODE)
            ? parameters.getParameterValue(OpenIdConstants.OPENID_MODE)
            : null;

    Message response = null;

    if (StringUtils.equals(mode, OpenIdConstants.ASSOCIATE)) {
        response = serverManager.associationResponse(parameters);
    }
    final Map<String, String> responseParams = new HashMap<>();
    if (response != null) {
        responseParams.putAll(response.getParameterMap());
    }

    return responseParams;

}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:29,代码来源:SmartOpenIdController.java

示例3: getAssociationResponse

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
/**
 * Gets the association response. Determines the mode first.
 * If mode is set to associate, will set the response. Then
 * builds the response parameters next and returns.
 *
 * @param request the request
 * @return the association response
 */
public Map<String, String> getAssociationResponse(final HttpServletRequest request) {
    final ParameterList parameters = new ParameterList(request.getParameterMap());

    final String mode = parameters.hasParameter(OpenIdProtocolConstants.OPENID_MODE)
            ? parameters.getParameterValue(OpenIdProtocolConstants.OPENID_MODE)
            : null;

    Message response = null;

    if (StringUtils.equals(mode, OpenIdProtocolConstants.ASSOCIATE)) {
        response = this.serverManager.associationResponse(parameters);
    }
    final Map<String, String> responseParams = new HashMap<>();
    if (response != null) {
        responseParams.putAll(response.getParameterMap());
    }

    return responseParams;

}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:29,代码来源:SmartOpenIdController.java

示例4: getAssociationResponse

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
public Map<String, String> getAssociationResponse(final HttpServletRequest request) {
    ParameterList parameters = new ParameterList(request.getParameterMap());

    final String mode = parameters.hasParameter("openid.mode")
            ? parameters.getParameterValue("openid.mode")
            : null;

    Message response = null;
    if (mode != null && mode.equals("associate")) {
        response = serverManager.associationResponse(parameters);
    }
    final Map<String, String> responseParams = new HashMap<String, String>();
    if (response != null) {
        responseParams.putAll(response.getParameterMap());
    }

    return responseParams;

}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:20,代码来源:SmartOpenIdController.java

示例5: getExtension

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
/**
 * Instantiates the apropriate Simple Registration object
 * (request / response) for the supplied parameter list.
 *
 * Similar to SRegMessage.getExtension(), but sets the SREG 1.1 type URI.
 *
 * @param parameterList         The Simple Registration specific parameters
 *                              (without the openid.<ext_alias> prefix)
 *                              extracted from the openid message.
 * @param isRequest             Indicates whether the parameters were
 *                              extracted from an OpenID request (true),
 *                              or from an OpenID response.
 * @return                      MessageExtension implementation for
 *                              the supplied extension parameters.
 * @throws MessageException     If a Simple Registration object could not be
 *                              instantiated from the supplied parameter list.
 */
public MessageExtension getExtension(
        ParameterList parameterList, boolean isRequest)
        throws MessageException
{
    SRegMessage sreg;

    if ( parameterList.hasParameter("required") ||
         parameterList.hasParameter("optional"))

        sreg = SRegRequest.createSRegRequest(parameterList);

    else
        sreg = SRegResponse.createSRegResponse(parameterList);

    sreg.setTypeUri(SRegMessage.OPENID_NS_SREG11);

    return sreg;
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:36,代码来源:SReg11ExtensionFactory.java

示例6: getOpenIDMessageMode

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
/**
 * Returns the mode field of the OpenID message.
 *
 * @param paramList
 * @param response
 * @param request
 * @return
 * @throws IOException
 */
private String getOpenIDMessageMode(ParameterList paramList, HttpServletResponse response,
                                    HttpServletRequest request) throws IOException {
    String mode = null;
    if (paramList == null) {
        if (log.isDebugEnabled()) {
            log.debug("Invalid OpenID message :" + request.getQueryString());
        }
        directResponse(response, getErrorResponseText("Invalid OpenID message"));
        return null;
    }
    mode = paramList.hasParameter(OpenId.ATTR_MODE) ? paramList.getParameterValue(OpenId.ATTR_MODE) : null;
    if (log.isDebugEnabled()) {
        log.debug("OpenID authentication mode :" + mode);
    }
    return mode;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:26,代码来源:OpenIDHandler.java

示例7: handleRequest

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
private void handleRequest(ParameterList requestParameter, String target, HttpServletResponse response, Request baseRequest) throws IOException, OpenIdAttackerServerException, TransformerException {
       // get the openIdProcessor.mode
       final String method = baseRequest.getMethod();
       final HttpURI uri = baseRequest.getUri();
       final String protocol = baseRequest.getProtocol();
       final String info = String.format("%s %s %s", method, uri, protocol);
       final String mode = requestParameter.hasParameter("openid.mode")
         ? requestParameter.getParameterValue("openid.mode") : null;

if (uri.getCompletePath().equals("/favicon.ico")) {
           handleFaviconRequest(info, response);
       } else if (target.contains("xxe")) {
           // Case: XXE
           handleXxeRequest(info, response, requestParameter);
       } /*else if (target.contains("dtd")) {
           // Case: DTD
           handleDtdRequest(info, response, requestParameter);
       }*/ else if (mode == null) {
           if (target.contains("xrds") || requestParameter.toString().contains("xrds")) {
               // Case: Request XRDS Document
               handleXrdsRequest(info, response);                
           } else {
               // Case: Request HTML Document
               handleHtmlDiscovery(info, response);
           }
       } else if ("associate".equals(mode)) {
           // Case: Process Association
           handleAssociationRequest(info, response, requestParameter);
       } else if ("checkid_setup".equals(mode) || "checkid_immediate".equals(mode)) {
           // Case: Generate Token
           handleTokenRequest(info, response, requestParameter);
       } else if ("check_authentication".equals(mode)) {
           handleCheckAuthentication(info, response, requestParameter);
       } else {
           throw new IllegalStateException("Unknown Request");
       }
       baseRequest.setHandled(true);
   }
 
开发者ID:RUB-NDS,项目名称:OpenID-Attacker,代码行数:39,代码来源:CustomOpenIdProviderHandler.java

示例8: addNamespaceIfNotContained

import org.openid4java.message.ParameterList; //导入方法依赖的package包/类
private void addNamespaceIfNotContained(ParameterList token_parameter) {
    if (!token_parameter.hasParameter("ns")) {
        final String nsValue = xrdsConfiguration.getOpenIdVersion().getNS();
        final Parameter nsParameter = new Parameter("openid.ns", nsValue);
        token_parameter.set(nsParameter);
    }
}
 
开发者ID:RUB-NDS,项目名称:OpenID-Attacker,代码行数:8,代码来源:CustomOpenIdProcessor.java


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