Skip to content

Commit

Permalink
Reverting PR openhab#11233 & PR openhab#11266
Browse files Browse the repository at this point in the history
Signed-off-by: Gaël L'hopital <gael@lhopital.org>
  • Loading branch information
clinique committed Oct 19, 2021
1 parent 9f80bea commit 362670a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
6 changes: 2 additions & 4 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,11 @@
<artifactId>org.openhab.binding.lifx</artifactId>
<version>${project.version}</version>
</dependency>
<!-- linky binding suppressed from the distribution until it is fixed
<dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.linky</artifactId>
<version>${project.version}</version>
</dependency>
-->
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.linuxinput</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ public class EnedisHttpApi {
private final HttpClient httpClient;
private final LinkyConfiguration config;
private boolean connected = false;
private CookieStore cookieStore;

public EnedisHttpApi(LinkyConfiguration config, Gson gson, HttpClient httpClient) {
this.gson = gson;
this.httpClient = httpClient;
this.config = config;
this.cookieStore = httpClient.getCookieStore();
}

public void initialize() throws LinkyException {
Expand Down Expand Up @@ -121,14 +123,14 @@ public void initialize() throws LinkyException {
}

AuthData authData = gson.fromJson(result.getContentAsString(), AuthData.class);
if (authData == null || authData.callbacks.size() < 2 || authData.callbacks.get(0).input.size() == 0
|| authData.callbacks.get(1).input.size() == 0 || !username
.equals(Objects.requireNonNull(authData.callbacks.get(0).input.get(0)).valueAsString())) {
if (authData == null || authData.callbacks.size() < 2 || authData.callbacks.get(0).input.isEmpty()
|| authData.callbacks.get(1).input.isEmpty()) {
throw new LinkyException("Authentication error, the authentication_cookie is probably wrong");
}

authData.callbacks.get(1).input.get(0).value = config.password;
url = "https://mon-compte.enedis.fr/auth/json/authenticate?realm=/enedis&spEntityID=SP-ODW-PROD&goto=/auth/SSOPOST/metaAlias/enedis/providerIDP?ReqID%"
url = URL_MON_COMPTE
+ "/auth/json/authenticate?realm=/enedis&spEntityID=SP-ODW-PROD&goto=/auth/SSOPOST/metaAlias/enedis/providerIDP?ReqID%"
+ reqId
+ "%26index%3Dnull%26acsURL%3Dhttps://apps.lincs.enedis.fr/saml/SSO%26spEntityID%3DSP-ODW-PROD%26binding%3Durn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&AMAuthCookie=";

Expand Down Expand Up @@ -178,7 +180,6 @@ private void disconnect() throws LinkyException {
String location = getLocation(httpClient.GET(URL_APPS_LINCS + "/logout"));
location = getLocation(httpClient.GET(location));
location = getLocation(httpClient.GET(location));
CookieStore cookieStore = httpClient.getCookieStore();
cookieStore.removeAll();
connected = false;
} catch (InterruptedException | ExecutionException | TimeoutException e) {
Expand All @@ -196,7 +197,6 @@ public void dispose() throws LinkyException {
}

private void addCookie(String key, String value) {
CookieStore cookieStore = httpClient.getCookieStore();
HttpCookie cookie = new HttpCookie(key, value);
cookie.setDomain(".enedis.fr");
cookie.setPath("/");
Expand Down
4 changes: 1 addition & 3 deletions bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@
<module>org.openhab.binding.lgtvserial</module>
<module>org.openhab.binding.lgwebos</module>
<module>org.openhab.binding.lifx</module>
<!-- linky binding suppressed from the distribution until it is fixed
<module>org.openhab.binding.linky</module>
-->
<module>org.openhab.binding.linky</module>
<module>org.openhab.binding.linuxinput</module>
<module>org.openhab.binding.lirc</module>
<module>org.openhab.binding.logreader</module>
Expand Down

0 comments on commit 362670a

Please sign in to comment.