org.apache.rampart.RampartMessageData Java Examples
The following examples show how to use
org.apache.rampart.RampartMessageData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecureSample.java From micro-integrator with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/samples/SecureDataService"; System.setProperty("javax.net.ssl.trustStore", (new File(CLIENT_JKS_PATH)).getAbsolutePath()); ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); client.engageModule("rampart"); options.setUserName("admin"); options.setPassword("admin"); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(SECURITY_POLICY_PATH)); Office[] offices = stub.showAllOffices(); for (Office office : offices) { System.out.println("\t-----------------------------"); System.out.println("\tOffice Code: " + office.getOfficeCode()); System.out.println("\tPhone: " + office.getPhone()); System.out.println("\tAddress Line 1: " + office.getAddressLine1()); System.out.println("\tAddress Line 2: " + office.getAddressLine2()); System.out.println("\tCity: " + office.getCity()); System.out.println("\tState: " + office.getState()); System.out.println("\tPostal Code: " + office.getPostalCode()); System.out.println("\tCountry: " + office.getCountry()); } }
Example #2
Source File: SecureSample.java From micro-integrator with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/samples/SecureDataService"; System.setProperty("javax.net.ssl.trustStore", (new File(CLIENT_JKS_PATH)).getAbsolutePath()); ConfigurationContext ctx = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); client.engageModule("rampart"); options.setUserName("admin"); options.setPassword("admin"); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(SECURITY_POLICY_PATH)); Office[] offices = stub.showAllOffices(); for (Office office : offices) { System.out.println("\t-----------------------------"); System.out.println("\tOffice Code: " + office.getOfficeCode()); System.out.println("\tPhone: " + office.getPhone()); System.out.println("\tAddress Line 1: " + office.getAddressLine1()); System.out.println("\tAddress Line 2: " + office.getAddressLine2()); System.out.println("\tCity: " + office.getCity()); System.out.println("\tState: " + office.getState()); System.out.println("\tPostal Code: " + office.getPostalCode()); System.out.println("\tCountry: " + office.getCountry()); } }
Example #3
Source File: SecureSample.java From product-ei with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/samples/SecureDataService"; System.setProperty("javax.net.ssl.trustStore", (new File(CLIENT_JKS_PATH)).getAbsolutePath()); ConfigurationContext ctx = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); client.engageModule("rampart"); options.setUserName("admin"); options.setPassword("admin"); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(SECURITY_POLICY_PATH)); Office[] offices = stub.showAllOffices(); for (Office office : offices) { System.out.println("\t-----------------------------"); System.out.println("\tOffice Code: " + office.getOfficeCode()); System.out.println("\tPhone: " + office.getPhone()); System.out.println("\tAddress Line 1: " + office.getAddressLine1()); System.out.println("\tAddress Line 2: " + office.getAddressLine2()); System.out.println("\tCity: " + office.getCity()); System.out.println("\tState: " + office.getState()); System.out.println("\tPostal Code: " + office.getPostalCode()); System.out.println("\tCountry: " + office.getCountry()); } }
Example #4
Source File: IWAUIAuthenticator.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * @param request * @return * @throws AxisFault */ private IWAAuthenticatorStub getIWAClient(HttpServletRequest request) throws AxisFault, IdentityException { HttpSession session = request.getSession(); ServletContext servletContext = session.getServletContext(); String backendServerURL = request.getParameter("backendURL"); if (backendServerURL == null) { backendServerURL = CarbonUIUtil.getServerURL(servletContext, request.getSession()); } ConfigurationContext configContext = (ConfigurationContext) servletContext .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String serviceEPR = backendServerURL + "IWAAuthenticator"; IWAAuthenticatorStub stub = new IWAAuthenticatorStub(configContext, serviceEPR); ServiceClient client = stub._getServiceClient(); client.engageModule("rampart"); Policy rampartConfig = IdentityBaseUtil.getDefaultRampartConfig(); Policy signOnly = IdentityBaseUtil.getSignOnlyPolicy(); Policy mergedPolicy = signOnly.merge(rampartConfig); Options options = client.getOptions(); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, mergedPolicy); options.setManageSession(true); return stub; }
Example #5
Source File: SecurityWithServiceDescriptorTest.java From product-ei with Apache License 2.0 | 4 votes |
@Test(groups = { "wso2.bps", "wso2.bps.security" }, description = "BPEL security test scenario - secure BPEL process with service.xml file") public void securityWithServiceDescriptorTest() throws Exception { requestSender.waitForProcessDeployment(backEndUrl + "SWSDPService"); // FrameworkConstants.start(); String securityPolicyPath = FrameworkPathUtil.getSystemResourceLocation() + BPSTestConstants.DIR_ARTIFACTS + File.separator + BPSTestConstants.DIR_POLICY + File.separator + "utpolicy.xml"; String endpointHttpS = "https://localhost:9645/services/SWSDPService"; String trustStore = CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator + "resources" + File.separator + "security" + File.separator + "wso2carbon.jks"; String clientKey = trustStore; OMElement result; System.setProperty("javax.net.ssl.trustStore", trustStore); System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon"); if (log.isDebugEnabled()) { log.debug("Carbon Home: " + CarbonUtils.getCarbonHome()); } ConfigurationContext ctx = ConfigurationContextFactory .createConfigurationContextFromFileSystem( CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator + "deployment" + File.separator + "client", null); ServiceClient sc = new ServiceClient(ctx, null); sc.engageModule("addressing"); sc.engageModule("rampart"); Options opts = new Options(); opts.setTo(new EndpointReference(endpointHttpS)); log.info(endpointHttpS); opts.setAction("urn:swsdp"); log.info("SecurityPolicyPath " + securityPolicyPath); opts.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(securityPolicyPath, clientKey, "admin")); sc.setOptions(opts); result = sc.sendReceive( AXIOMUtil.stringToOM("<p:swsdp xmlns:p=\"http://wso2.org/bpel/sample.wsdl\">\n" + " <TestPart>ww</TestPart>\n" + " </p:swsdp>")); log.info(result.getFirstElement().getText()); Assert.assertFalse("Incorrect Test Result: " + result.toString(), !result.toString().contains("ww World")); }