Skip to content

Commit

Permalink
Merge branch 'master' into oxAuth_issues_1896
Browse files Browse the repository at this point in the history
Signed-off-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
  • Loading branch information
yurem committed Apr 2, 2024
2 parents e56a0f8 + c2f4def commit 746d07b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Expand Up @@ -10,6 +10,7 @@
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
Expand All @@ -18,6 +19,7 @@
* @author Yuriy Movchan Date: 03/21/2024
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class DeviceNotificationConf implements Serializable {

private static final long serialVersionUID = -8173244116167488365L;
Expand Down
Expand Up @@ -904,12 +904,12 @@ def getTargetEndpointArn(self, deviceRegistrationService, pushSnsService, platfo

# Return endpoint ARN if it created already
notificationConf = u2fDevice.getDeviceNotificationConf()
notificationConfJson = {}
if StringHelper.isNotEmpty(notificationConf):
notificationConfJson = json.loads(notificationConf)
targetEndpointArn = notificationConfJson['sns_endpoint_arn']
if StringHelper.isNotEmpty(targetEndpointArn):
if 'sns_endpoint_arn' in notificationConfJson:
print "Super-Gluu. Get target endpoint ARN. There is already created target endpoint ARN"
return targetEndpointArn
return notificationConfJson['sns_endpoint_arn']

# Create endpoint ARN
pushClient = None
Expand Down Expand Up @@ -950,9 +950,10 @@ def getTargetEndpointArn(self, deviceRegistrationService, pushSnsService, platfo
print "Super-Gluu. Get target endpoint ARN. Create target endpoint ARN '%s' for user: '%s'" % (targetEndpointArn, user.getUserId())

# Store created endpoint ARN in device entry
notificationConfJson['sns_endpoint_arn'] = targetEndpointArn
userInum = user.getAttribute("inum")
u2fDeviceUpdate = deviceRegistrationService.findUserDeviceRegistration(userInum, u2fDevice.getId())
u2fDeviceUpdate.setDeviceNotificationConf('{"sns_endpoint_arn" : "%s"}' % targetEndpointArn)
u2fDeviceUpdate.setDeviceNotificationConf(json.dumps(notificationConfJson))
deviceRegistrationService.updateDeviceRegistration(userInum, u2fDeviceUpdate)

return targetEndpointArn
Expand Down
Expand Up @@ -191,7 +191,7 @@ public DeviceRegistrationResult finishAuthentication(AuthenticateRequestMessage
if (pushTokenUpdated) {
prepareForPushTokenChange(usedDeviceRegistration);
}

usedDeviceRegistration.setDeviceData(deviceData);
} catch (Exception ex) {
throw new BadInputException(String.format("Device data is invalid: %s", responseDeviceData), ex);
}
Expand Down

0 comments on commit 746d07b

Please sign in to comment.