Commit 0d95ce9ff4dc439ceb67e7fe2a7c06618031ce2f

Authored by Steven Glover
1 parent f5a8f250e0
Exists in master and in 1 other branch REPO1550

REPO-1550 "Change JSON response from Repository Service Provider to comply with …

…other autherization endpoints" fix up fallout from Repo SP REST API response changes
app/src/main/java/com/alfresco/android/saml/api/models/SamlEnabledRepresentationEntry.java
... ... @@ -0,0 +1,37 @@
  1 +package com.alfresco.android.saml.api.models;
  2 +
  3 +import com.google.gson.annotations.Expose;
  4 +import com.google.gson.annotations.SerializedName;
  5 +
  6 +import java.io.Serializable;
  7 +import java.util.Objects;
  8 +
  9 +public class SamlEnabledRepresentationEntry implements Serializable
  10 +{
  11 +
  12 + @SerializedName("entry")
  13 + @Expose
  14 + private SamlEnabledRepresentation entry;
  15 +
  16 + public SamlEnabledRepresentation getEntry()
  17 + {
  18 + return entry;
  19 + }
  20 +
  21 + public void setEntry(SamlEnabledRepresentation entry)
  22 + {
  23 + this.entry = entry;
  24 + }
  25 +
  26 + @Override
  27 + public int hashCode()
  28 + {
  29 + return entry.hashCode();
  30 + }
  31 +
  32 + @Override
  33 + public String toString()
  34 + {
  35 + return entry.toString();
  36 + }
  37 +}
... ...
app/src/main/java/com/alfresco/android/saml/api/models/SamlTicketRepresentationEntry.java
... ... @@ -0,0 +1,35 @@
  1 +package com.alfresco.android.saml.api.models;
  2 +
  3 +import com.google.gson.annotations.Expose;
  4 +import com.google.gson.annotations.SerializedName;
  5 +
  6 +import java.io.Serializable;
  7 +import java.util.Objects;
  8 +
  9 +public class SamlTicketRepresentationEntry implements Serializable
  10 +{
  11 +
  12 + @SerializedName("entry")
  13 + @Expose
  14 + private SamlTicketRepresentation entry;
  15 +
  16 + public SamlTicketRepresentation getEntry() {
  17 + return entry;
  18 + }
  19 +
  20 + public void setEntry(SamlTicketRepresentation entry) {
  21 + this.entry = entry;
  22 + }
  23 +
  24 + @Override
  25 + public int hashCode()
  26 + {
  27 + return entry.hashCode();
  28 + }
  29 +
  30 + @Override
  31 + public String toString()
  32 + {
  33 + return entry.toString();
  34 + }
  35 +}
... ...
app/src/main/java/com/alfresco/android/saml/ui/activity/SignInActivity.java
... ... @@ -14,7 +14,9 @@ import android.webkit.WebViewClient;
14 14 import com.alfresco.android.saml.R;
15 15 import com.alfresco.android.saml.api.SAMLConstant;
16 16 import com.alfresco.android.saml.api.models.SamlEnabledRepresentation;
  17 +import com.alfresco.android.saml.api.models.SamlEnabledRepresentationEntry;
17 18 import com.alfresco.android.saml.api.models.SamlTicketRepresentation;
  19 +import com.alfresco.android.saml.api.models.SamlTicketRepresentationEntry;
18 20 import com.google.gson.Gson;
19 21  
20 22 public class SignInActivity extends AppCompatActivity
... ... @@ -67,9 +69,9 @@ public class SignInActivity extends AppCompatActivity
67 69 if (message.startsWith("{"))
68 70 {
69 71 Gson gson = new Gson();
70   - SamlTicketRepresentation ticketRepresentation = gson.fromJson(message,
71   - SamlTicketRepresentation.class);
72   - ticketRepresentation.getTicket();
  72 + SamlTicketRepresentationEntry ticketRepresentationEntry = gson.fromJson(message,
  73 + SamlTicketRepresentationEntry.class);
  74 + SamlTicketRepresentation ticketRepresentation = ticketRepresentationEntry.getEntry();
73 75  
74 76 Intent ticketIntent = new Intent();
75 77 ticketIntent.putExtra(ApiTestActivity.EXTRA_ID_SAML_TICKET, ticketRepresentation);
... ... @@ -85,9 +87,9 @@ public class SignInActivity extends AppCompatActivity
85 87 if (message.startsWith("{"))
86 88 {
87 89 Gson gson = new Gson();
88   - SamlEnabledRepresentation enabledRepresentation = gson.fromJson(message,
89   - SamlEnabledRepresentation.class);
90   - enabledRepresentation.getIdpDescription();
  90 + SamlEnabledRepresentationEntry enabledRepresentationEntry = gson.fromJson(message,
  91 + SamlEnabledRepresentationEntry.class);
  92 + enabledRepresentationEntry.getEntry().getIdpDescription();
91 93 }
92 94 }
93 95 return true;
... ...