Skip to content

Seat Login#

Seat login object initialization#

To implement login functionality in Seat, we start by initializing the SeatLogin object, which serves as the entry point for the login process. The SeatLogin class provides the initService method, which allows us to initialize the SeatLogin.

 SeatLogin.initService(this, new IInFlightCallback() {
            @Override
            public void onInitServiceComplete(Object o, String s) {
                seatLogin = (SeatLogin) o;
            }
            @Override
            public void onInitServiceFailed(String s, InFlight.Error error) {
                Log.e(TAG, "onInitServiceFailed()");
            }
        }, new InFlight());

Parameters:

context - Provides access to resources and classes to initialize the object

inFlightCallback - IInFlightCallback Returns the instance or error message

inFlight - Initializes an InFlight instance

Determine whether the IFE supports login functionality#

Verify the availability of passenger data integration and login functionality. If either is unavailable, logging in will not be possible.

1. isPdiAvailable()

The method returns true if PDI data is available; otherwise, it returns false. It will return false if there is no PMD or if a PMD exists but the flight parameters do not match.

 boolean isPdiAvailable = seatLogin.isPdiAvailable();

2. isLoginReady()

The method returns the login availability information and the server is ready for the login. It returns a boolean value

boolean isLoginReady = seatLogin.isLoginReady();

Retrieve the fields necessary for login.#

In this step, the login fields required for authentication must be retrieved. These fields vary depending on the airline customer.

1. getLoginFieldsNeeded()

The method returns a list of fields in the JSON string required for the login, e.g., email_addres, frequent_flyer_number. We can log in using the field that returns from this API.

String loginFieldJson = seatLogin.getLoginFieldsNeeded();

Following is the JSON obtained after calling the getLoginFieldNeeded method.

{
    "attemptsRemaining": 3,
    "authFields": {
        "fields": [
            "frequent_flyer.frequent_flyer_number_last_4_digits",
            "travel_info.ticket_number_last_4_digits"
        ],
        "operator": "or"
    },
    "authFieldsPed": {
        "fields": [
            "frequent_flyer.frequent_flyer_number",
            "travel_info.ticket_number"
        ],
        "operator": "or"
    },
    "hashFields": [
        "frequent_flyer.frequent_flyer_number",
        "frequent_flyer.frequent_flyer_number_last_4_digits",
        "travel_info.ticket_number",
        "travel_info.ticket_number_last_4_digits"
    ],
    "loggedIn": false,
    "loginAvailable": true,
    "pdiAvailable": true,
    "timeRemaining": 0
}

The following observations in the response may be useful:

  • The response includes the pdiAvailable and loginAvailable states, allowing you to optionally use this API instead of the isPdiAvailable and isLoginReady APIs, respectively.

  • The response may include different authentication fields based on the class (e.g., PED vs. Seatback, First vs. Economy).

  • The response may indicate whether the server expects the authentication fields to be hashed.

  • The attemptsRemaining and timeRemaining fields are relevant if the passenger exceeds the allowed number of failed attempts.

2. getLoginState()

The method provides the login state. It returns the login state as an enum. The enum contains four different values and those are LOGIN_STATE_UNKNOWN, LOGIN_STATE_LOGGED_IN, LOGIN_STATE_NOT_LOGGED_IN, LOGIN_STATE_LOCKED

 LoginState loginState = seatLogin.getLoginState();

Register the listeners required for login#

1. Login ready change listener

setLoginReadyChangeListener(SeatLogin.LoginReadyChangeListener loginReadyChangeListener)

This method is used to register the listener for a login-ready change event. The SeatLogin.LoginReadyChangeListener includes the onLoginReadyChanged method, which triggers this event.

 seatLogin.setLoginReadyChangeListener(new SeatLogin.LoginReadyChangeListener() {
                    @Override
                    public void onLoginReadyChanged(boolean b) {

                    }
                });

2. Login state change listener

setLoginStateChangeListener(SeatLogin.LoginStateChangeListener loginStateChangeListener)

This method is used to register the listener for the login state change event. The SeatLogin.LoginStateChangeListener must be registered using this method. The interface provides two methods: onLoginStateChanged and onLoginFailed. The onLoginStateChanged method provides one of the state-like LOGIN_STATE_UNKNOWN, LOGIN_STATE_LOGGED_IN, LOGIN_STATE_NOT_LOGGED_IN, LOGIN_STATE_LOCKED. The onLoginFailed provides the failure reason like NO_MATCH, MATCH, INVALID, DUPLICATE, ATTEMPT_EXCEED_LIMIT, UNKNOWN. The same method provided the number of attempts remaining in the second parameter, and time remaining in the third parameter.

  seatLogin.setLoginStateChangeListener(new SeatLogin.LoginStateChangeListener() {
                                                          @Override
                                                          public void onLoginStateChanged(LoginState loginState) {

                                                          }

                                                          @Override
                                                          public void onLoginFailed(SeatLogin.LoginFailureReason loginFailureReason, int i, int i1) {

                                                          }
                                                      });

3. PDI available change listener

The airline customer may send multiple PMDs to the aircraft. When a new PMD is received, the Interactive should retrieve the PDI information again, as a passenger's profile may have changed. Assigning a listener enables the Interactive to detect and respond to any PDI updates.

setPdiAvailableChangeListener(SeatLogin.PdiAvailableChangeListener pdiAvailableChangeListener)

 seatLogin.setPdiAvailableChangeListener(new SeatLogin.PdiAvailableChangeListener() {
                    @Override
                    public void onPdiAvailableChanged(boolean b) {

                    }
                });

Passenger login to IFE#

1. Login

The method used for authentication is called "login," where the passenger's input is provided via the loginFields map. For instance, if the following authentication fields are required. The authentication fields vary from airline to airline, first, we need to get login fields using getLoginFieldsNeeded.

login(Map<String,String> loginFields, boolean logoutPreviousSeat)

The passenger can authenticate using the last four digits of their ticket number. In this case, the loginFields map would appear as follows

Map<String,String> loginField = new HashMap();
loginField.put("travel_info.ticket_number_last_4_digits","0ffe1abd1a08215353c233d6e009613e95eec4253832a761af28ff37ac5a150c");
seatLogin.login(loginField,true);

If hashing is required, it can be determined from the response of the getLoginFieldNeeded method, which specifies which field needs to be hashed.

If logoutPreviousSeat is set to true, it will log the passenger out from the seat if they are already logged into another seat. If set to false, and the passenger is already logged into a different seat, an error will be thrown, preventing the passenger from logging into the seat they are attempting to access.

2. Logout

The method used to log out from the seat. On successfully logging out the onLoginStateChanged method of LoginStateChangeListener gets triggered and the login state will be LOGIN_STATE_NOT_LOGGED_IN

seatLogin.logout();

3. Reset the login field needed

The method used to reset the login field. If the login state is set to 1, then this method is used to set the login state to 0. The PAX Profile service allows login retries with different authentication parameters. Suppose the airline allows the passenger to log in with only their email address on the first attempt. Suppose multiple passengers have the same email address (i.e., a family traveling together under a single email address). In that case, the passenger should provide a different set of authentication parameters on a 2nd retry. These authentication parameters can be specified through the service configuration block in the PMD, which is appended by the ground PDI server. An example is provided below

        "auth_fields_all": [
            "email_address|frequent_flyer_number",
            "email_address&frequent_flyer_number_last_4_digits"
        ]

Suppose the airline specifies 2 states under which the passenger can log in. In state 0, the passenger can log in with their email address or the frequent_flyer_number alone. If there is a duplicate, the PAX Profile service will move the next login attempt to state 1, where the passenger must supply both the email address and the frequent flyer number’s last 4 digits. This is a method used to reset the state to 0

seatLogin.resetLoginFieldsNeeded();

Version 1.0