Skip to content

Commit

Permalink
Merge branch 'fix/issues-from-identity-service' into feature/improve-…
Browse files Browse the repository at this point in the history
…sync-timeout
  • Loading branch information
guss84 committed Dec 14, 2023
2 parents 41aa81e + 5d4eedd commit 50d4b39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
2 changes: 1 addition & 1 deletion rest/authentication/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def authenticate_user_oidc(self, access_token, oidc_provider_id):
def authenticate_user_basic(self, access_token):
decoded = decode_sh_access_token(access_token)
try:
user = SHUser(decoded["sub"], sh_access_token=access_token, sh_userinfo=decoded)
user = SHUser(decoded["account"], sh_access_token=access_token, sh_userinfo=decoded)
except BillingPlanInvalid:
return None

Expand Down
30 changes: 1 addition & 29 deletions rest/authentication/cert.pem
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
-----BEGIN CERTIFICATE-----
MIIFXjCCBEagAwIBAgIQCbCsLbWjj2N1zP/4iWMwRjANBgkqhkiG9w0BAQsFADCB
kDELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNjA0BgNV
BAMTLUNPTU9ETyBSU0EgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBD
QTAeFw0xNzEyMDUwMDAwMDBaFw0xOTAxMjAyMzU5NTlaMGAxITAfBgNVBAsTGERv
bWFpbiBDb250cm9sIFZhbGlkYXRlZDEeMBwGA1UECxMVRXNzZW50aWFsU1NMIFdp
bGRjYXJkMRswGQYDVQQDDBIqLnNlbnRpbmVsLWh1Yi5jb20wggEiMA0GCSqGSIb3
DQEBAQUAA4IBDwAwggEKAoIBAQDKfQo03h9DG1P0KNDRyuGqCsCbpgF98gfQslRM
mbLqWbIh8J+ycoW4lG/GxkkM5F2yf7mzN1eYF3N/ij+hfKqUg3Jw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hfeEtim23dWAl7Xw6D/b4L8UA+qjOAa2da4Azm/9bg==
-----END CERTIFICATE-----
8 changes: 4 additions & 4 deletions rest/authentication/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ def get_account_type_number(self):
if "d" in self.sh_userinfo and "1" in self.sh_userinfo["d"] and "t" in self.sh_userinfo["d"]["1"]:
return self.sh_userinfo["d"]["1"]["t"]
else:
account_id = self.sh_userinfo["account"]
r = requests.get(
f"https://services.sentinel-hub.com/oauth/users/{self.user_id}/accounts",
f"https://services.sentinel-hub.com/ims/accounts/{account_id}/account-info",
headers={"Authorization": f"Bearer {self.sh_access_token}"},
)

data = json.loads(r.content.decode("utf-8"))
for member in data["member"]:
if member["domainId"] == 1:
return member["type"]
return data["type"]

def get_user_info(self):
user_info = super().get_user_info()
Expand Down

0 comments on commit 50d4b39

Please sign in to comment.