usos login fix - deploy

This commit is contained in:
unknown 2019-12-01 13:03:18 +01:00
parent f61eda3990
commit b9c9cfee6f
3 changed files with 19 additions and 2 deletions

View File

@ -22,6 +22,12 @@ public class PropertiesLoader {
@Value("${application.secret}") @Value("${application.secret}")
private String secret; private String secret;
@Value("${server.address}")
private String serverAddress;
@Value("${server.port}")
private String serverPort;
public void initUsosInstance() { public void initUsosInstance() {
RestAssured.baseURI = usosBaseURI; RestAssured.baseURI = usosBaseURI;
RestAssured.basePath = usosBasePath; RestAssured.basePath = usosBasePath;
@ -40,4 +46,11 @@ public class PropertiesLoader {
return secret; return secret;
} }
public String getServerAddress() {
return serverAddress;
}
public String getServerPort() {
return serverPort;
}
} }

View File

@ -49,6 +49,7 @@ public class AuthorizationService {
private static final String ENC = "UTF-8"; private static final String ENC = "UTF-8";
private static final String HMAC_SHA1 = "HmacSHA1"; private static final String HMAC_SHA1 = "HmacSHA1";
private static Base64 base64 = new Base64(); private static Base64 base64 = new Base64();
@Autowired @Autowired
private PropertiesLoader propertiesLoader; private PropertiesLoader propertiesLoader;
@ -201,7 +202,7 @@ public class AuthorizationService {
private String getAuthToken(String username, String password) throws IOException { private String getAuthToken(String username, String password) throws IOException {
HttpClient httpClient = HttpClientBuilder.create().build(); HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost("http://localhost:8080/login"); HttpPost request = new HttpPost("http://" + propertiesLoader.getServerAddress() + ":" + propertiesLoader.getServerPort()+ "/login");
StringEntity params = new StringEntity("{\"username\":\"" + username + "\",\"password\":\"" + password + "\"} "); StringEntity params = new StringEntity("{\"username\":\"" + username + "\",\"password\":\"" + password + "\"} ");
request.addHeader("content-type", "application/json"); request.addHeader("content-type", "application/json");
request.setEntity(params); request.setEntity(params);

View File

@ -6,7 +6,10 @@ spring.datasource.password=L0XIcnvtWpYEnr4w
spring.servlet.multipart.max-file-size=500KB spring.servlet.multipart.max-file-size=500KB
spring.servlet.multipart.max-request-size=500KB spring.servlet.multipart.max-request-size=500KB
#server.address=51.75.30.146 server.address=51.75.30.146
server.port=8080
#server.address=localhost
#server.port=8080 #server.port=8080
#usos instance to use #usos instance to use