本文整理汇总了Java中org.openid4java.message.ParameterList类的典型用法代码示例。如果您正苦于以下问题:Java ParameterList类的具体用法?Java ParameterList怎么用?Java ParameterList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterList类属于org.openid4java.message包,在下文中一共展示了ParameterList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createService
import org.openid4java.message.ParameterList; //导入依赖的package包/类
@Override
public OpenIdService createService(final HttpServletRequest request) {
final String service = request.getParameter(OpenIdProtocolConstants.OPENID_RETURNTO);
final String openIdIdentity = request.getParameter(OpenIdProtocolConstants.OPENID_IDENTITY);
if (openIdIdentity == null || !StringUtils.hasText(service)) {
return null;
}
final String id = cleanupUrl(service);
final String artifactId = request.getParameter(OpenIdProtocolConstants.OPENID_ASSOCHANDLE);
final ParameterList paramList = new ParameterList(request.getParameterMap());
final OpenIdServiceResponseBuilder builder = new OpenIdServiceResponseBuilder(
paramList, this.openIdPrefixUrl);
return new OpenIdService(id, service, artifactId, openIdIdentity, builder);
}
示例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(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;
}
示例4: createServiceFrom
import org.openid4java.message.ParameterList; //导入依赖的package包/类
/**
* Creates the service from the request.
*
* @param request the request
* @param openIdPrefixUrl the prefix url for OpenID
* @return the OpenID service
*/
public static OpenIdService createServiceFrom(
final HttpServletRequest request, final String openIdPrefixUrl) {
final String service = request.getParameter(OpenIdConstants.OPENID_RETURNTO);
final String openIdIdentity = request.getParameter(OpenIdConstants.OPENID_IDENTITY);
final String signature = request.getParameter(OpenIdConstants.OPENID_SIG);
if (openIdIdentity == null || !StringUtils.hasText(service)) {
return null;
}
final String id = cleanupUrl(service);
final String artifactId = request.getParameter(OpenIdConstants.OPENID_ASSOCHANDLE);
final ParameterList paramList = new ParameterList(request.getParameterMap());
return new OpenIdService(id, service, artifactId, openIdIdentity,
signature, paramList, openIdPrefixUrl);
}
示例5: handleRequestInternal
import org.openid4java.message.ParameterList; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final String openIdMode = request.getParameter(OpenIdProtocolConstants.OPENID_MODE);
if (StringUtils.equals(openIdMode, OpenIdProtocolConstants.CHECK_AUTHENTICATION)) {
final VerifyResponse message = (VerifyResponse)
this.serverManager.verify(new ParameterList(request.getParameterMap()));
final Map<String, String> parameters = new HashMap<>();
parameters.putAll(message.getParameterMap());
if (message.isSignatureVerified()) {
LOGGER.debug("Signature verification request successful.");
return new ModelAndView(getSuccessView(), parameters);
}
LOGGER.debug("Signature verification request unsuccessful.");
return new ModelAndView(getFailureView(), parameters);
}
// we should probably fail here(?),
// since we only deal OpenId signature verification
return super.handleRequestInternal(request, response);
}
示例6: 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;
}
示例7: getAssociation
import org.openid4java.message.ParameterList; //导入依赖的package包/类
/**
* Gets association.
*
* @param serverManager the server manager
* @param parameterList the parameter list
* @return the association
*/
protected Association getAssociation(final ServerManager serverManager, final ParameterList parameterList) {
try {
final AuthRequest authReq = AuthRequest.createAuthRequest(parameterList, serverManager.getRealmVerifier());
final Map parameterMap = authReq.getParameterMap();
if (parameterMap != null && !parameterMap.isEmpty()) {
final String assocHandle = (String) parameterMap.get(OpenIdProtocolConstants.OPENID_ASSOCHANDLE);
if (assocHandle != null) {
return serverManager.getSharedAssociations().load(assocHandle);
}
}
} catch (final MessageException e) {
LOGGER.error("Message exception : [{}]", e.getMessage(), e);
}
return null;
}
示例8: 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;
}
示例9: createServiceFrom
import org.openid4java.message.ParameterList; //导入依赖的package包/类
public static OpenIdService createServiceFrom(
final HttpServletRequest request) {
final String service = request.getParameter(CONST_PARAM_SERVICE);
final String openIdIdentity = request.getParameter("openid.identity");
final String signature = request.getParameter("openid.sig");
if (openIdIdentity == null || !StringUtils.hasText(service)) {
return null;
}
final String id = cleanupUrl(service);
final String artifactId = request.getParameter("openid.assoc_handle");
ParameterList paramList = new ParameterList(request.getParameterMap());
return new OpenIdService(id, service, artifactId, openIdIdentity,
signature, paramList);
}
示例10: retrieveCredentials
import org.openid4java.message.ParameterList; //导入依赖的package包/类
@Override
protected OpenIdCredentials retrieveCredentials(final WebContext context) throws HttpAction {
final String mode = context.getRequestParameter(OPENID_MODE);
// cancelled authentication
if (CommonHelper.areEquals(mode, CANCEL_MODE)) {
logger.debug("authentication cancelled");
return null;
}
// parameters list returned by the provider
final ParameterList parameterList = new ParameterList(context.getRequestParameters());
// retrieve the previously stored discovery information
final DiscoveryInformation discoveryInformation = (DiscoveryInformation) context
.getSessionAttribute(getDiscoveryInformationSessionAttributeName());
// create credentials
final OpenIdCredentials credentials = new OpenIdCredentials(discoveryInformation, parameterList, getName());
logger.debug("credentials: {}", credentials);
return credentials;
}
示例11: 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;
}
示例12: MockOpenIDServer
import org.openid4java.message.ParameterList; //导入依赖的package包/类
public MockOpenIDServer(int port) {
super(port);
this.port = port;
setHandler(new AbstractHandler() {
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int dispatch)
throws IOException, ServletException {
MockOpenIDServer.this.requestParams.add(request.getParameterMap());
ParameterList params = new ParameterList();
params.set(new Parameter("ns",AssociationResponse.OPENID2_NS));
params.set(new Parameter("assoc_handle",String.valueOf(System.nanoTime())));
params.set(new Parameter("assoc_type",request.getParameter("openid.assoc_type")));
params.set(new Parameter("session_type",request.getParameter("openid.session_type")));
params.set(new Parameter("expires_in","1799"));
params.set(new Parameter("dh_server_public","eRm/Qn9lXQJc30ZQLtNFkrjQHuQCLyQ2fRNwLZTGVP50Lhx16EjksA6N0RvXzoJgY8/FdKioOYXKeWVvstHTUReXfF5EC9cnTVOFtTrMegJXHZIHdk+IITwsfGfTlVxMOc7DdCFOOMRWMOA9sYB5n5OoxnzYCob3vo39+Xytlcs="));
params.set(new Parameter("enc_mac_key","CY08gTx1u4XravtWT3V5Er4sG+o="));
response.getWriter().write(params.toString());
((Request) request).setHandled(true);
}
});
}
示例13: handleTokenRequest
import org.openid4java.message.ParameterList; //导入依赖的package包/类
public void handleTokenRequest(String info, HttpServletResponse response, final ParameterList requestParameter) throws IOException, OpenIdAttackerServerException {
LOG.info("--> BEGIN handleTokenRequest");
// check whether the association handle should be excluded from
// Authentication Request => force direct authentication
/*if (OpenIdServerConfiguration.getAttackerInstance().isRemoveAssocHandleFromAuthRequest()) {
requestParameter.removeParameters("openid.assoc_handle");
} */
// check settings for GET or POST redirect
if (idpType.equals(IdpType.ANALYZER)) {
if (OpenIdServerConfiguration.getAnalyzerInstance().isMethodGet()){
handleTokenRequestwithGetRedirect(response, requestParameter);
} else {
handleTokenRequestWithPostRedirect(info, response, requestParameter);
}
} else {
if (OpenIdServerConfiguration.getAttackerInstance().isMethodGet()){
handleTokenRequestwithGetRedirect(response, requestParameter);
} else {
handleTokenRequestWithPostRedirect(info, response, requestParameter);
}
}
LOG.info("--> END handleTokenRequest");
}
示例14: handleCheckAuthentication
import org.openid4java.message.ParameterList; //导入依赖的package包/类
private void handleCheckAuthentication(String info, HttpServletResponse response, final ParameterList requestParameter) throws IOException {
LOG.info("--> BEGIN handleCheckAuthentication");
String assocHandle = requestParameter.getParameterValue("openid.assoc_handle");
String shortLog = String.format("Returning check_authentication = true for %s", assocHandle);
LOG.info(String.format(" --> assoc_handle = %s", assocHandle));
Message responseMessage;
if (idpType.equals(IdpType.ATTACKER)) {
responseMessage = getOpenIdProcessor().generatePositiveCheckAuthenticationResponse();
} else {
responseMessage = getOpenIdProcessor().generateCorrectCheckAuthenticationResponse(requestParameter);
}
String responseText = responseMessage.keyValueFormEncoding();
response.getWriter().println(responseText);
response.setStatus(HttpServletResponse.SC_OK);
String requestText = String.format("%s\n\n%s", info, requestParameter.toString());
RequestLogger.getInstance().add(RequestType.CHECK_AUTHENTICATION, shortLog, requestText, responseText, idpType);
LOG.info("--> END handleCheckAuthentication");
}
示例15: getUserProfiles
import org.openid4java.message.ParameterList; //导入依赖的package包/类
/**
* @param openid
* @return
* @throws IdentityProviderException
*/
public OpenIDUserProfileDTO[] getUserProfiles(String openid, ParameterList requredClaims)
throws IdentityProviderException {
OpenIDParameterDTO[] params = null;
List list = null;
list = requredClaims.getParameters();
params = new OpenIDParameterDTO[list.size()];
int i = 0;
for (Object object : list) {
Parameter param = (Parameter) object;
OpenIDParameterDTO openIDParameterDTO = new OpenIDParameterDTO();
openIDParameterDTO.setName(param.getKey());
openIDParameterDTO.setValue(param.getValue());
params[i++] = openIDParameterDTO;
}
return openIDProviderService.getUserProfiles(openid, params);
}