question: public void validateLoginRequest ( String username , String uid , String signature , String timestamp ) throws DataAccessException , UnauthorizedException { if ( ! Utilities . isTimestampValid ( timestamp ) ) { throw new UnauthorizedException ( "Invalid timestamp: " + timestamp ) ; } log . info ( String . format ( "Timestamp [ %s ] is valid" , timestamp ) ) ; log . info ( "Validate signature: " + signature ) ; UserInfo user = userAuthenticator . getUserInfo ( username ) ; if ( user == null ) { throw new UnauthorizedException ( "Couldn't find user: " + username ) ; } if ( ! validateSignature ( timestamp , user . getHashedPassword ( ) , signature ) ) { throw new UnauthorizedException ( "Invalid signature: " + signature ) ; } log . info ( "Signature matched!!!" ) ; DeviceInfo device = regenerateKey ( uid , user . getUsername ( ) ) ; log . info ( "Device found/registered successfully!!!" ) ; if ( ! deviceBelongsToUser ( user . getUsername ( ) , device . getUsername ( ) ) ) { throw new UnauthorizedException ( String . format ( "User [ %s ] doesn't match the device's owner [ %s ]" , user . getUsername ( ) , device . getUsername ( ) ) ) ; } }
target:  Verify if the login request is valid. Username and UID are authenticated. The timestamp is checked to see it falls within the valid timestamp window. The signature is computed and matched against the given signature. Also its checked to see if the UID belongs to the username. This function is useful in Identity mode