/** * Process a request for association from the RP * * @param requestParams * @return */ public OpenIDMessage processAssociationRequest(ParameterList requestParams) { return new OpenIDMessage(serverManager.associationResponse(requestParams)); }
/** * Processes a Authentication Request received from a consumer site. * <p/> * Uses ServerManager's global OpenID Provider endpoint URL. * * @return A signed positive Authentication Response if successfull, * or an IndirectError / DirectError message. * @see #authResponse(org.openid4java.message.AuthRequest, String, String, * boolean, String, boolean) */ public Message authResponse(AuthRequest authReq, String userSelId, String userSelClaimed, boolean authenticatedAndApproved) { return authResponse(authReq, userSelId, userSelClaimed, authenticatedAndApproved, _opEndpointUrl, true); }
/** * Process a verification request from RP for an already authenticated user * * @param requestParams * @return */ public OpenIDMessage verify(ParameterList requestParams) { return new OpenIDMessage(serverManager.verify(requestParams)); }
public SampleServer(String endPointUrl) { manager.setOPEndpointUrl(endPointUrl); // for a working demo, not enforcing RP realm discovery // since this new feature is not deployed manager.getRealmVerifier().setEnforceRpId(false); }
/** * Initialize the Shared Association and Private Association stores * * @param sharedAssociationStore a set of 2 association stores {@code ServerAssociationStore} * @throws {@code IllegalArgumentException} if the number of stores is not 2 */ public void initialize(ServerAssociationStore... sharedAssociationStore) { if (sharedAssociationStore == null || sharedAssociationStore.length == 0) { initialize(); return; } if (sharedAssociationStore.length != 2) throw new IllegalArgumentException("Number of association stores not equal to 2"); serverManager.setSharedAssociations(sharedAssociationStore[0]); serverManager.setPrivateAssociations(sharedAssociationStore[1]); }
response = manager.associationResponse(request); responseText = response.keyValueFormEncoding(); } else if ("checkid_setup".equals(mode) AuthRequest.createAuthRequest(request, manager.getRealmVerifier()); response = manager.authResponse(request, opLocalId, userSelectedClaimedId, manager.sign((AuthSuccess) response); response = manager.verify(request); responseText = response.keyValueFormEncoding(); } else {
public String process(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); ServerManager manager = new ServerManager(); manager.setSharedAssociations(new InMemoryServerAssociationStore()); manager.setPrivateAssociations(new InMemoryServerAssociationStore()); manager.setOPEndpointUrl(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/simple-openid/provider.jsp"); responsem = manager.associationResponse(requestp); responseText = responsem.keyValueFormEncoding(); } else if ("checkid_setup".equals(mode) || "checkid_immediate".equals(mode)) { responsem = manager.authResponse(requestp, userSelectedId, userSelectedClaimedId, authenticatedAndApproved.booleanValue()); responsem = manager.verify(requestp); responseText = responsem.keyValueFormEncoding(); } else {
ConcurrentMap<String, Object> attribs = getContext().getAttributes(); ServerManager manager = (ServerManager) attribs.get("openid_manager"); log.info("OP endpoint = " + manager.getOPEndpointUrl()); response = manager.associationResponse(request); responseText = response.keyValueFormEncoding(); } else if ("checkid_setup".equals(mode) manager.getOPEndpointUrl()); response = manager.authResponse(request, userSelectedId, userSelectedClaimedId, authenticatedAndApproved.booleanValue()); response = manager.verify(request); log.info("OpenID : " + response.keyValueFormEncoding()); responseText = response.keyValueFormEncoding();
RealmVerifier realmVerifier = serverManager.getRealmVerifier(); ParameterList parameterList = retrieveParameterList(httpSession); AuthRequest authRequest = AuthRequest.createAuthRequest(parameterList, LOG.debug("normalized user identifier: " + userIdentifier); Message message = serverManager.authResponse(parameterList, userIdentifier, userIdentifier, true, false); serverManager.sign(authSuccess);
serverManager = new ServerManager(); .setSharedAssociations(new InMemoryServerAssociationStore()); serverManager .setPrivateAssociations(new InMemoryServerAssociationStore()); String location = "https://" + request.getServerName(); if (request.getServerPort() != 443) { String opEndpointUrl = location + "/protocol/" + getPath(); LOG.debug("OP endpoint URL: " + opEndpointUrl); serverManager.setOPEndpointUrl(opEndpointUrl); servletContext .setAttribute(getServiceManagerAttribute(), serverManager);
@RefreshScope @Bean public ServerManager serverManager() { val manager = new ServerManager(); manager.setOPEndpointUrl(casProperties.getServer().getLoginUrl()); manager.setEnforceRpId(casProperties.getAuthn().getOpenid().isEnforceRpId()); manager.setSharedAssociations(new InMemoryServerAssociationStore()); LOGGER.info("Creating openid server manager with OP endpoint [{}]", casProperties.getServer().getLoginUrl()); return manager; }
RealmVerifier realmVerifier = serverManager.getRealmVerifier(); AuthRequest authRequest = AuthRequest.createAuthRequest(parameterList, realmVerifier);
/** * Set the end point where the provider is active * * @param url */ public void setEndPoint(String url) { serverManager.setOPEndpointUrl(url); }
/** * Configure the OpenID Provider's end-point URL */ private OpenIDProvider() { // This is the OpenID provider server URL opAddress = OpenIDUtil.getOpenIDServerURL(); // The URL which accepts OpenID Authentication requests, obtained by // performing discovery on the the User-Supplied Identifier. This value // must be an absolute URL manager.setOPEndpointUrl(opAddress); // default association expiry time is set to 15 minutes int assocExpiryTime = 15; String expiryTime = IdentityUtil.getProperty(IdentityConstants.ServerConfig.OPENID_ASSOCIATION_EXPIRY_TIME); if (expiryTime != null && !expiryTime.trim().isEmpty()) { try { assocExpiryTime = Integer.parseInt(expiryTime); } catch (NumberFormatException e) { log.warn("Error while setting association expiry time as " + expiryTime + ". Setting association expiry time to default ("+assocExpiryTime+")", e); } } manager.setExpireIn(assocExpiryTime); }
/** * 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 { val authReq = AuthRequest.createAuthRequest(parameterList, serverManager.getRealmVerifier()); val parameterMap = authReq.getParameterMap(); if (parameterMap != null && !parameterMap.isEmpty()) { val 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; }
response = manager.associationResponse(request); responseText = response.keyValueFormEncoding(); AuthRequest.createAuthRequest(request, manager.getRealmVerifier()); response = manager.authResponse(request, opLocalId, userSelectedClaimedId, manager.sign((AuthSuccess) response); response = manager.verify(request); responseText = response.keyValueFormEncoding();
public String process(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); ServerManager manager = new ServerManager(); manager.setSharedAssociations(new InMemoryServerAssociationStore()); manager.setPrivateAssociations(new InMemoryServerAssociationStore()); manager.setOPEndpointUrl(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/simple-openid/provider.jsp"); responsem = manager.associationResponse(requestp); responseText = responsem.keyValueFormEncoding(); } else if ("checkid_setup".equals(mode) || "checkid_immediate".equals(mode)) { responsem = manager.authResponse(requestp, userSelectedId, userSelectedClaimedId, authenticatedAndApproved.booleanValue()); responsem = manager.verify(requestp); responseText = responsem.keyValueFormEncoding(); } else {
manager = OpenIDProvider.getInstance().getManager(); try { authReq = AuthRequest.createAuthRequest(paramList, manager.getRealmVerifier()); } catch (MessageException e) { throw new IdentityProviderException("Error while creating authentication request", e); manager.authResponse(paramList, requestDTO.getOpLocalId(), requestDTO.getUserSelectedClaimedId(), requestDTO.isAuthenticated()); AuthSuccess authSuccess = (AuthSuccess) message; authSuccess.addSignExtension((String) alias); manager.sign(authSuccess);
public SampleServer(String endPointUrl) { manager.setOPEndpointUrl(endPointUrl); // for a working demo, not enforcing RP realm discovery // since this new feature is not deployed manager.getRealmVerifier().setEnforceRpId(false); }
/** * Initialize the Shared Association and Private Association stores * * @param sharedAssociationStore a set of 2 association stores {@code ServerAssociationStore} * @throws {@code IllegalArgumentException} if the number of stores is not 2 */ public void initialize(ServerAssociationStore... sharedAssociationStore) { if (sharedAssociationStore == null || sharedAssociationStore.length == 0) { initialize(); return; } if (sharedAssociationStore.length != 2) throw new IllegalArgumentException("Number of association stores not equal to 2"); serverManager.setSharedAssociations(sharedAssociationStore[0]); serverManager.setPrivateAssociations(sharedAssociationStore[1]); }