When I package for production, and I want to recover my password, url which leads me to my mail it is incorrect.
http://localhost:8095/af/#/reset/finish?key=03106204321257101265
The right thing would be
https://www.XXX.es/af/#/reset/finish?key=03106204321257101265
I do not see any property in .yml and not to the steps to put the base url me I need.
Jhipster 3.4.2
Thanks for the help
Set server.port and server.address properties in your application-prod.yml file. Please refer to Spring Boot doc for details and alternate ways of setting these.
It seems that dynamically form, but when it is on the server also takes as "request.getServerName()"= "localhost"
Do not use the built-in Jhipster Tomcat, but other external.
public ResponseEntity<?> requestPasswordReset(#RequestBody String mail, HttpServletRequest request) {
System.out.println("scheme"+ request.getScheme());
System.out.println("server name" + request.getServerName());
System.out.println("server port" + request.getServerPort());
System.out.println("context path"+ request.getContextPath());
return userService.requestPasswordReset(mail)
.map(user -> {
String baseUrl = request.getScheme() +
"://" +
request.getServerName() +
":" +
request.getServerPort() +
request.getContextPath();
mailService.sendPasswordResetMail(user, baseUrl);
return new ResponseEntity<>("e-mail was sent", HttpStatus.OK);
}).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST));
}
Related
I have two questions here. One, I am not able to run my appium tests against the sauce labs driver url specified in my account settings https://xxxxx:xxxxxxx#ondemand.eu-central-1.saucelabs.com:443/wd/hub. I do not get any error too..
But, i am able to run my tests against http://appium.testobject.com/wd/hub url. But i am not sure where to see my test results. If i try https://app.testobject.com, I am not able to login even though i give the correct credentials and am already logged in sauce labs. Please help.
I noticed a few things that could be doing wrong here. First, you are trying to run the tests on the European datacenter and port 443, which is an https connection. See which endpoint you should connect to. Some possible solutions:
Make sure you are using the endpoint for US West (if you are in the US and that is the data center you signed up for)
All your capabilities are up to date
You used your sauce username and access key when connecting to the driver.
It's hard to know what is wrong without capabilities and knowing if you want to connect to a virtual device or a real device, testing an app or browser. Here is an example configuration for an app test on RDC:
#BeforeMethod
public void setup(Method method) throws MalformedURLException {
System.out.println("Sauce iOS Native - BeforeMethod hook");
String username = System.getenv("SAUCE_USERNAME");
String accesskey = System.getenv("SAUCE_ACCESS_KEY");
String sauceUrl;
if (region.equalsIgnoreCase("eu")) {
sauceUrl = "#ondemand.eu-central-1.saucelabs.com:443";
} else {
sauceUrl = "#ondemand.us-west-1.saucelabs.com:443";
}
String SAUCE_REMOTE_URL = "https://" + username + ":" + accesskey + sauceUrl +"/wd/hub";
String appName = "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa";
String methodName = method.getName();
URL url = new URL(SAUCE_REMOTE_URL);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "iPhone 8.*");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("automationName", "XCuiTest");
capabilities.setCapability("app", "storage:filename="+appName);
try {
iosDriver.set(new IOSDriver(url, capabilities));
} catch (Exception e) {
System.out.println("*** Problem to create the iOS driver " + e.getMessage());
throw new RuntimeException(e);
}
}
I found out how to view my test results while using http://appium.testobject.com/wd/hub url. Navigate to saucelabs as usual. Then select "legacy rdc" under Sauce Apps in the displayed page. You can view the results in the displayed window.
I am testing the DocuSign API Client for Java.
The problem is that the testing environment as well as the production environment is behind a corporate Proxy that needs authentication (username + password, not just host + port).
But I see no way to configure the DocuSign ApiClient.
I only can set up http.proxyHost and http.proxyPort, but no http.proxyUser and http.proxyPassword.
System.getProperties().put("http.proxyHost", host);
System.getProperties().put("https.proxyHost", host);
System.getProperties().put("http.proxyPort", String.valueOf(port));
System.getProperties().put("https.proxyPort", String.valueOf(port));
System.getProperties().put("http.proxyUser", user);
System.getProperties().put("http.proxyPassword", password);
Authenticator.setDefault(
new Authenticator() {
#Override
public PasswordAuthentication getPasswordAuthentication() {
if (getRequestorType() == Authenticator.RequestorType.PROXY) {
System.out.println(getRequestingHost() + ":" + getRequestingPort() + " -> " + getRequestingURL());
return new PasswordAuthentication(user, password.toCharArray());
}
return null;
}
}
);
Setting the Authenticator.setDefault() works with default java http client, but it does not show any effect when using the DocuSign ApiClient.
yes, you can do that using:
For HTTPS (recommended): https.proxyHost, https.proxyPort, https.proxyUser and https.proxyPassword
For HTTP: http.proxyHost, http.proxyPort, http.proxyUser and http.proxyPassword
this was added in version 2.9.0 of the client which was released in Feb, so if you have that or later - you should be good
I have updated from 2.8.0 to 2.9.0.
I have tested it but currently I still get the same exception com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required"
I used this code as recommended in the last answer:
System.getProperties().put("http.proxyHost", host);
System.getProperties().put("https.proxyHost", host);
System.getProperties().put("http.proxyPort", String.valueOf(port));
System.getProperties().put("https.proxyPort", String.valueOf(port));
System.getProperties().put("http.proxyUser", user);
System.getProperties().put("https.proxyUser", user);
System.getProperties().put("http.proxyPassword", password);
System.getProperties().put("https.proxyPassword", password);
The problem is that http.proxyUser and http.proxyPassword don't get recognized by the DocuSign API Client.
Hi i am using liferay/api/secure/jsonws services to upload documents, getting documents, from a outside application , in the same way i want to download the documents also, i checked my liferay jsonws , there is no method or service which i can use for download , or i don't know about it , please suggest me a way to download documents from outside application , by using jsonws or any other way is also fine.
Edit after i got to know how to download document.
Hi I tried to download liferay document from outside application by using getURl, but every time for all document i am getting liferay login page content
i have already tried get-file-as-stream json-rpc call but that also giving me null response
the code which i have used is:
final HttpHost targetHost = new HttpHost(hostname.trim());
System.out.println(targetHost.getHostName());
UsernamePasswordCredentials creds = new UsernamePasswordCredentials(username, password);
System.out.println(creds);
final AuthScope authscope = new AuthScope(targetHost);
httpclient.getCredentialsProvider().setCredentials(authscope, creds);
final AuthCache authCache = new BasicAuthCache();
final BasicScheme basicAuth = new BasicScheme();
authCache.put(targetHost, basicAuth);
final BasicHttpContext localContext = new BasicHttpContext();
localContext.setAttribute(ClientContext.AUTH_CACHE, authCache);
final HttpGet httpget = new HttpGet(hostname+"/documents/" + groupId + "/" + folderId + "/" + filename);
final HttpResponse response = httpclient.execute( httpget, localContext);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
final org.apache.http.HttpEntity entity = response.getEntity();
if (entity != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
entity.writeTo(baos);
return baos.toByteArray();
}
}
return null;
} finally {
httpclient.getConnectionManager().shutdown();
}
}
i am adding basic auth header will correct username and password, don't know how this login page is coming, is there any permission which i need to change or any configurations issue, please help in this.
You could use the Liferay WebDav Services to download files from your document-library. The paths to download can be inspected inside of the control-panel when clicking on a file entry (WebDAV URL toogle link). The paths usually look like: /webdav/{site-name}/document_library/{folder-name}/{file-name}
Otherwise, you could mimic the request URLs Liferay creates inside the documents-media portlet to download the file entry.
But you should take care about authentication, when your files (and folders) are not visible to guests.
I have a c# DOT NET Winforms application that has been working just fine in the developer environment. Yesterday it just stopped working for some reason. No code changes at all. It seems to be timing out while logging in.
private string DocLogin()
{
ErrMsg = string.Empty;
string _accountId = null;
try
{
var _apiClient = new ApiClient(DocuSignURL);
Config = new Configuration(_apiClient);
// configure 'X-DocuSign-Authentication' header
string _authHeader = "{\"Username\":\"" + Username + "\", \"Password\":\"" + Password + "\", \"IntegratorKey\":\"" + IntegratorKey + "\"}";
Config.AddDefaultHeader("X-DocuSign-Authentication", _authHeader);
// we will retrieve this from the login API call
AuthenticationApi _authApi = new AuthenticationApi(Config);
LoginInformation _loginInfo = _authApi.Login();
_accountId = _loginInfo.LoginAccounts[0].AccountId;
}
catch (Exception ex)
{
_accountId = null;
ErrMsg = ex.Message;
}
return _accountId;
}
As soon as it hits the line "_authApi.Login()" it hangs up then throws the error, "Error calling Login: The operation has timed out".
Any ideas? Remember there has been no code changes and was working fine. I thought about corporate firewall but I tried it outside of the firewall with the same results.
Seems DocuSign stopped TLS1.0 support. See Amit's post above for the link to the solution.
I am trying to set the redirect_uri in Azure B2C. I have a language field in the Url like this:
https://mydomain/de-de/projects
https://mydomain/en-us/projects
https://mydomain/sv-se/projects
https://mydomain/ar-sa/projects
...
and to be correctly redirected, I have to add all the possibilities to the B2C Reply URLs and I am only limited to 20 max.
Is there a way to add variables to the redirect_uri?
Something like:
https://mydomain/:lang/projects
where ":lang" is a variable the could take any value.
////////////////////////////////////
Solution
The tricky solution was to manipulate the state and inject it with the returned URL due to the fact that it will be sent back after the login/signup response. createLoginUrl() method:
let url = that.loginUrl
+ '?response_type='
+ response_type
+ '&client_id='
+ encodeURIComponent(that.clientId)
+ '&state='
+ encodeURIComponent((state) + 'url' + returnedUrl)
+ '&redirect_uri='
+ encodeURIComponent(window.location.origin)
+ '&scope='
+ encodeURIComponent(that.scope);
so here I split the state with 'url' word so I can read it again after the response came.
encodeURIComponent((state) + 'url' + returnedUrl)
An important details redirect_uri, it should be the same origin:
'&redirect_uri=' + encodeURIComponent(window.location.origin)
and this URL should be added to the returned URL in Azure B2C application.
Now I can split it again in tryLogin() method:
const statePartsWithUrl = (parts['state'] + '').split('url');
window.location.href = statePartsWithUrl[1];
and it works perfectly.
////-------------------------------------
Edit : 1.2.2019
const statePartsWithUrl = (parts['state'] + '').split('url');
let state = '';
let returnedUrl = '';
if (statePartsWithUrl != null) {
state = statePartsWithUrl[0];
returnedUrl = statePartsWithUrl[1];
}
Here is the splitting of the state to read the information from it in method tryLogin(options)
Yeah so as you found out, you can't currently add wildcards to reply URLs in B2C.
This may be due to security concerns defined in the OAuth 2.0 Threat Model and Security Considerations RFC.
In it, the suggested counter-measure against Open Redirect Attacks is to have the client register the full redirect URI.
There is also no way to create apps programmatically: https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/19975480-programmatically-register-b2c-applications.
So sadly the manual way is the only way at the moment. But be sure to go upvote the feature request on User Voice.
I actually even tried to manually edit an app via Graph Explorer:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "Updates to converged applications are not allowed in this version."
},
"date": "2018-01-08T12:00:00",
"requestId": "208e7159-d459-42ec-8bb7-000000000000",
"values": null
}
}
As you suggested in the comments, one way to work around this problem would be to use a single static redirect URI and keep the language/culture in the state/a cookie, and then do the redirect to the language-specific version after the user is returned to the app.