本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}