authenticateUser static method
Future<AuthenticationDto?>
authenticateUser(
- WardenType? localWardenType,
- WardenType remoteWardenType,
- String? passKey,
- WaterState stateType,
- int version,
- SchemaMetaData smd,
- SchemaMetaData smdSys,
- DbTransaction transaction,
- UserTools userTools,
- ConfigurationNameDefaults defaults,
Implementation
static Future<AuthenticationDto?> authenticateUser(
WardenType? localWardenType,
WardenType remoteWardenType,
String? passKey,
WaterState stateType,
int version,
SchemaMetaData smd,
SchemaMetaData smdSys,
DbTransaction transaction,
UserTools userTools,
ConfigurationNameDefaults defaults) async {
late RemoteDto remoteDto;
RestGetAuthenticationUtils informationUtils = RestGetAuthenticationUtils(
localWardenType,
remoteWardenType,
smd,
smdSys,
transaction,
userTools,
defaults,
null);
await informationUtils.init();
try {
remoteDto =
await informationUtils.requestAuthenticationFromServer(version);
} on SqlException catch (e) {
if (e.sqlExceptionEnum == SqlExceptionEnum.ENTRY_NOT_FOUND ||
e.sqlExceptionEnum == SqlExceptionEnum.FAILED_UPDATE ||
e.sqlExceptionEnum == SqlExceptionEnum.FAILED_SELECT)
print("WS $e");
else
rethrow;
}
AuthenticationDto? authenticationDto;
switch (remoteDto.water_table_id) {
case RemoteStatusDto.C_TABLE_ID:
RemoteStatusDto remoteStatusDto = remoteDto as RemoteStatusDto;
print("jj=" + remoteStatusDto.toString());
break;
case AuthenticationDto.C_TABLE_ID:
authenticationDto = remoteDto as AuthenticationDto;
print("ww=" + authenticationDto.toString());
break;
default:
print("UNKNOWN=" + remoteDto.water_table_name);
}
return authenticationDto;
}