All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.launchkey.sdk.domain.service.AuthorizationResponse Maven / Gradle / Ivy

Go to download

SDK for interacting with the LaunchKey distributed authentication and authorization platform

The newest version!
/**
 * Copyright 2016 LaunchKey, Inc. All rights reserved.
 * 

* Licensed under the MIT License. * You may not use this file except in compliance with the License. * A copy of the License is located in the "LICENSE.txt" file accompanying * this file. This file is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.launchkey.sdk.domain.service; import java.util.List; /** * Object that represents the current state of an service request within the Platform. */ public class AuthorizationResponse { /** * Unique identifier for the authorization request generated by the LaunchKey API. */ private final String authorizationRequestId; /** * Has the request been authorized by the user. */ private final boolean authorized; /** * Hashed user identifier to track a specific user for an application. This value will be used by the * Logout Callback to identify the user logging out. This value may * be used in place of a username or White Label User identifier for authorization requests. */ private final String serviceUserHash; /** * A string that uniquely identifies the user across the entire Organization to which the Application whose Application Key * was included in the request belongs. This will be returned if, and only if, the Application belongs to an * Organization. */ private final String organizationUserHash; /** * A value uniquely and permanently identifying the User associated with the authorization request within the Application whose * Application Key was included in the request belongs. */ private final String userPushId; /** * Identifier that is unique for a single user identifying the device the user utilized to respond to the * authorization request. */ private final String deviceId; private final List servicePins; /** * @param authorizationRequestId Unique identifier for the authorization request generated by the LaunchKey API. * @param authorized The users response to the authorization request. True and False are authorized and declined * respectively. * @param serviceUserHash Hashed identifier of the User that responded to the authentication request. This * value will be used by the De-Orbit Callback to identify the de-orbiting User. This value may * be used in place of a username or White Label User identifier for authorization requests. * @param organizationUserHash Unique identifier of the User that responded to the authentication request within the * organization in which the Application for this request resides. This will be returned if, * and only if, the Application belongs to an Organization. * @param userPushId Unique identifier of the User that responded to the authorization request * within the Application to which this authorization request was made. * @param deviceId Identifier for the device the User utilized to respond to the authorization request. * @param servicePins List of random values returned */ public AuthorizationResponse( String authorizationRequestId, boolean authorized, String serviceUserHash, String organizationUserHash, String userPushId, String deviceId, List servicePins) { this.authorizationRequestId = authorizationRequestId; this.authorized = authorized; this.serviceUserHash = serviceUserHash; this.organizationUserHash = organizationUserHash; this.userPushId = userPushId; this.deviceId = deviceId; this.servicePins = servicePins; } /** * Get the unique identifier for the authentication request for which this is the response. * * @return Authentication request ID */ public String getAuthorizationRequestId() { return authorizationRequestId; } /** * Get the users response to the service request. True and False are authorized and declined respectively. * * @return Authorized response value */ public boolean isAuthorized() { return authorized; } /** * Hashed identifier of the User that responded to the authentication request. This value will be used by the * De-Orbit Callback to identify the de-orbiting User. * * @return User hash */ public String getServiceUserHash() { return serviceUserHash; } /** * Get the unique identifier of the User that responded to the authentication request within the organization in * which the Application for this request resides. This will be returned if, and only if, the Application belongs to an * Organization. * * @return Organization-User ID */ public String getOrganizationUserHash() { return organizationUserHash; } /** * Get the unique identifier of the User that responded to the authentication request within the Application to * which this authorization request was made. This value may be used in place of a username or White Label * User identifier for authorization requests. * . * * @return User push ID */ public String getUserPushId() { return userPushId; } /** * Get the identifier for the device the User utilized to respond to the authentication request. This * value is unique to the User that responded to the authentication request and may be duplicated in another User. * * @return Device ID */ public String getDeviceId() { return deviceId; } /** * A list of up to 5 random value strings that are unique for a Device and Service combination. The list is * intended for Device validation at the Service. Devices will rotate out Service pins as a queue, first in - * first out (FIFO). As such, they are rotating shared secrets known only to the device and the Service. Service * pins can be used to protect against a myriad of potential attacks. However, they do run the risk of devices * getting "out of sync" and resulting in devices not being able to authenticate. If you implement service pins * in your solutions, you will need to build in a recovery mechanism to reset the known service pins and re-sync * the device. * * @return List of Device Pins */ public List getServicePins() { return servicePins; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AuthorizationResponse)) return false; AuthorizationResponse that = (AuthorizationResponse) o; if (isAuthorized() != that.isAuthorized()) return false; if (getAuthorizationRequestId() != null ? !getAuthorizationRequestId().equals(that.getAuthorizationRequestId()) : that.getAuthorizationRequestId() != null) return false; if (getServiceUserHash() != null ? !getServiceUserHash().equals(that.getServiceUserHash()) : that.getServiceUserHash() != null) return false; if (getOrganizationUserHash() != null ? !getOrganizationUserHash().equals(that.getOrganizationUserHash()) : that.getOrganizationUserHash() != null) return false; if (getUserPushId() != null ? !getUserPushId().equals(that.getUserPushId()) : that.getUserPushId() != null) return false; if (getDeviceId() != null ? !getDeviceId().equals(that.getDeviceId()) : that.getDeviceId() != null) return false; return getServicePins() != null ? getServicePins().equals(that.getServicePins()) : that.getServicePins() == null; } @Override public int hashCode() { int result = getAuthorizationRequestId() != null ? getAuthorizationRequestId().hashCode() : 0; result = 31 * result + (isAuthorized() ? 1 : 0); result = 31 * result + (getServiceUserHash() != null ? getServiceUserHash().hashCode() : 0); result = 31 * result + (getOrganizationUserHash() != null ? getOrganizationUserHash().hashCode() : 0); result = 31 * result + (getUserPushId() != null ? getUserPushId().hashCode() : 0); result = 31 * result + (getDeviceId() != null ? getDeviceId().hashCode() : 0); result = 31 * result + (getServicePins() != null ? getServicePins().hashCode() : 0); return result; } @Override public String toString() { return "AuthorizationResponse{" + "authorizationRequestId='" + authorizationRequestId + '\'' + ", authorized=" + authorized + ", serviceUserHash='" + serviceUserHash + '\'' + ", organizationUserHash='" + organizationUserHash + '\'' + ", userPushId='" + userPushId + '\'' + ", deviceId='" + deviceId + '\'' + ", servicePins=" + servicePins + '}'; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy