mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 04:02:57 +00:00
IAuth
This commit is contained in:
parent
8a30c92e19
commit
26794f08e7
@ -36,5 +36,7 @@ enum ExceptionCode {
|
||||
AlreadyUnlistened,
|
||||
NotListenable,
|
||||
ParseError,
|
||||
Timeout
|
||||
Timeout,
|
||||
NotSupported,
|
||||
NotImplemented
|
||||
}
|
||||
|
@ -214,6 +214,7 @@ class Codec {
|
||||
UInt8: DataSerializer.uInt8Composer,
|
||||
Int16: DataSerializer.int16Composer,
|
||||
UInt16: DataSerializer.uInt16Composer,
|
||||
Float32: DataSerializer.float128Composer,
|
||||
int: DataSerializer.int64Composer,
|
||||
//[typeof(long?)] = DataSerializer.Int64Composer,
|
||||
//[typeof(ulong)] = DataSerializer.UIn64Composer,
|
||||
|
@ -45,13 +45,13 @@ class DataDeserializer {
|
||||
|
||||
static AsyncReply byteParser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return new AsyncReply<int>.ready(data[offset]);
|
||||
return new AsyncReply<UInt8>.ready(data[offset].cast());
|
||||
}
|
||||
|
||||
static AsyncReply sByteParser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return new AsyncReply<int>.ready(
|
||||
data[offset] > 127 ? data[offset] - 256 : data[offset]);
|
||||
return new AsyncReply<Int8>.ready(
|
||||
data[offset] > 127 ? (data[offset] - 256).cast() : data[offset].cast());
|
||||
}
|
||||
|
||||
static AsyncReply char16Parser(DC data, int offset, int length,
|
||||
@ -66,27 +66,27 @@ class DataDeserializer {
|
||||
|
||||
static AsyncReply int16Parser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return AsyncReply<int>.ready(data.getInt16(offset));
|
||||
return AsyncReply<Int16>.ready(data.getInt16(offset).cast());
|
||||
}
|
||||
|
||||
static AsyncReply uInt16Parser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return AsyncReply<int>.ready(data.getUint16(offset));
|
||||
return AsyncReply<UInt16>.ready(data.getUint16(offset).cast());
|
||||
}
|
||||
|
||||
static AsyncReply int32Parser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return AsyncReply<int>.ready(data.getInt32(offset));
|
||||
return AsyncReply<Int32>.ready(data.getInt32(offset).cast());
|
||||
}
|
||||
|
||||
static AsyncReply uInt32Parser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return AsyncReply<int>.ready(data.getUint32(offset));
|
||||
return AsyncReply<UInt32>.ready(data.getUint32(offset).cast());
|
||||
}
|
||||
|
||||
static AsyncReply float32Parser(DC data, int offset, int length,
|
||||
DistributedConnection? connection, List<int>? requestSequence) {
|
||||
return AsyncReply<double>.ready(data.getFloat32(offset));
|
||||
return AsyncReply<Float32>.ready(data.getFloat32(offset).cast());
|
||||
}
|
||||
|
||||
static AsyncReply float64Parser(DC data, int offset, int length,
|
||||
@ -322,7 +322,10 @@ class DataDeserializer {
|
||||
offset += valueRep.size;
|
||||
length -= valueRep.size;
|
||||
|
||||
var map = Map();
|
||||
|
||||
var keyRuntimeType = keyRep.type.getRuntimeType();
|
||||
|
||||
var map = keyRuntimeType == null ? Map() : Warehouse.createMap(keyRuntimeType);
|
||||
var rt = new AsyncReply();
|
||||
|
||||
var results = new AsyncBag();
|
||||
|
@ -35,35 +35,35 @@ class DataSerializer {
|
||||
static DataSerializerComposeResults int32Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(4);
|
||||
rt.setInt32(0, (value as Int32).toInt());
|
||||
rt.setInt32(0, (value as Int32).toNum());
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.Int32, rt);
|
||||
}
|
||||
|
||||
static DataSerializerComposeResults uInt32Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(4);
|
||||
rt.setUint32(0, (value as UInt32).toInt());
|
||||
rt.setUint32(0, (value as UInt32).toNum());
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.UInt32, rt);
|
||||
}
|
||||
|
||||
static DataSerializerComposeResults int16Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(2);
|
||||
rt.setInt16(0, (value as Int16).toInt());
|
||||
rt.setInt16(0, (value as Int16).toNum());
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.Int16, rt);
|
||||
}
|
||||
|
||||
static DataSerializerComposeResults uInt16Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(2);
|
||||
rt.setUint16(0, (value as UInt16).toInt());
|
||||
rt.setUint16(0, (value as UInt16).toNum());
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.UInt16, rt);
|
||||
}
|
||||
|
||||
static DataSerializerComposeResults float32Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(4);
|
||||
rt.setFloat32(0, value as double);
|
||||
rt.setFloat32(0, (value as Float32).toNum());
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.Float32, rt);
|
||||
}
|
||||
|
||||
@ -140,14 +140,14 @@ class DataSerializer {
|
||||
static DataSerializerComposeResults uInt8Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(1);
|
||||
rt[0] = (value as UInt8).toInt();
|
||||
rt[0] = (value as UInt8).toNum();
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.UInt8, rt);
|
||||
}
|
||||
|
||||
static DataSerializerComposeResults int8Composer(
|
||||
value, DistributedConnection? connection) {
|
||||
var rt = new DC(1);
|
||||
rt[0] = (value as Int8).toInt();
|
||||
rt[0] = (value as Int8).toNum();
|
||||
return DataSerializerComposeResults(TransmissionTypeIdentifier.Int8, rt);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
class IntType {
|
||||
int _value = 0;
|
||||
class IntType<T extends num> {
|
||||
T _value;
|
||||
|
||||
bool operator ==(Object other) {
|
||||
if (other is IntType)
|
||||
@ -27,15 +27,44 @@ class IntType {
|
||||
return this._value <= other._value;
|
||||
}
|
||||
|
||||
operator +(IntType other) {
|
||||
this._value += other._value;
|
||||
|
||||
IntType<T> operator +(IntType<T> other) {
|
||||
if (this is Int8)
|
||||
return new Int8(this._value + other._value as int) as IntType<T>;
|
||||
else if (this is UInt8)
|
||||
return new UInt8(this._value + other._value as int) as IntType<T>;
|
||||
else if (this is Int16)
|
||||
return new Int16(this._value + other._value as int) as IntType<T>;
|
||||
else if (this is UInt16)
|
||||
return new UInt16(this._value + other._value as int) as IntType<T>;
|
||||
else if (this is Int32)
|
||||
return new Int32(this._value + other._value as int) as IntType<T>;
|
||||
else if (this is UInt32)
|
||||
return new UInt32(this._value + other._value as int) as IntType<T>;
|
||||
|
||||
return new IntType(this._value + other._value as int) as IntType<T>;
|
||||
}
|
||||
|
||||
operator -(IntType other) {
|
||||
this._value -= other._value;
|
||||
|
||||
|
||||
IntType<T> operator -(IntType<T> other) {
|
||||
if (this is Int8)
|
||||
return new Int8(this._value - other._value as int) as IntType<T>;
|
||||
else if (this is UInt8)
|
||||
return new UInt8(this._value - other._value as int) as IntType<T>;
|
||||
else if (this is Int16)
|
||||
return new Int16(this._value - other._value as int) as IntType<T>;
|
||||
else if (this is UInt16)
|
||||
return new UInt16(this._value - other._value as int) as IntType<T>;
|
||||
else if (this is Int32)
|
||||
return new Int32(this._value - other._value as int) as IntType<T>;
|
||||
else if (this is UInt32)
|
||||
return new UInt32(this._value - other._value as int) as IntType<T>;
|
||||
|
||||
return new IntType(this._value - other._value as int) as IntType<T>;
|
||||
}
|
||||
|
||||
int toInt() => _value;
|
||||
T toNum() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value.toString();
|
||||
@ -44,26 +73,55 @@ class IntType {
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
class Int32 extends IntType {
|
||||
class Int32 extends IntType<int> {
|
||||
Int32(int value) : super(value);
|
||||
}
|
||||
|
||||
class Int16 extends IntType {
|
||||
class Int16 extends IntType<int> {
|
||||
Int16(int value) : super(value);
|
||||
}
|
||||
|
||||
class Int8 extends IntType {
|
||||
class Int8 extends IntType<int> {
|
||||
Int8(int value) : super(value);
|
||||
}
|
||||
|
||||
class UInt32 extends IntType {
|
||||
class UInt32 extends IntType<int> {
|
||||
UInt32(int value) : super(value);
|
||||
}
|
||||
|
||||
class UInt16 extends IntType {
|
||||
class UInt16 extends IntType<int> {
|
||||
UInt16(int value) : super(value);
|
||||
}
|
||||
|
||||
class UInt8 extends IntType {
|
||||
class UInt8 extends IntType<int> {
|
||||
UInt8(int value) : super(value);
|
||||
}
|
||||
|
||||
class Float32 extends IntType<double> {
|
||||
Float32(double value) : super(value);
|
||||
}
|
||||
|
||||
|
||||
extension IntTypeCasting on int {
|
||||
T cast<T>() {
|
||||
switch(T){
|
||||
case Int8: return Int8(this) as T;
|
||||
case UInt8: return UInt8(this) as T;
|
||||
case Int16: return Int16(this) as T;
|
||||
case UInt16: return UInt16(this) as T;
|
||||
case Int32: return Int32(this) as T;
|
||||
case UInt32: return UInt32(this) as T;
|
||||
}
|
||||
|
||||
return IntType(this) as T;
|
||||
}
|
||||
}
|
||||
|
||||
extension Float32Casting on double {
|
||||
T cast<T>() {
|
||||
|
||||
if (T == Float32)
|
||||
return Float32(this) as T;
|
||||
return IntType(this) as T;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'package:esiur/src/Data/IntType.dart';
|
||||
|
||||
import 'IEnum.dart';
|
||||
import '../Resource/Template/TemplateType.dart';
|
||||
import 'IRecord.dart';
|
||||
@ -135,15 +137,15 @@ class RepresentationType {
|
||||
RepresentationTypeIdentifier.Dynamic: [dynamic, dynamic],
|
||||
RepresentationTypeIdentifier.Bool: [bool, getNullableType<bool>()],
|
||||
RepresentationTypeIdentifier.Char: [String, getNullableType<String>()],
|
||||
RepresentationTypeIdentifier.UInt8: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.Int8: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.Int16: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.UInt16: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.Int32: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.UInt32: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.UInt8: [UInt8, getNullableType<UInt8>()],
|
||||
RepresentationTypeIdentifier.Int8: [Int8, getNullableType<Int8>()],
|
||||
RepresentationTypeIdentifier.Int16: [Int16, getNullableType<Int16>()],
|
||||
RepresentationTypeIdentifier.UInt16: [UInt16, getNullableType<UInt16>()],
|
||||
RepresentationTypeIdentifier.Int32: [Int32, getNullableType<Int32>()],
|
||||
RepresentationTypeIdentifier.UInt32: [UInt32, getNullableType<UInt32>()],
|
||||
RepresentationTypeIdentifier.Int64: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.UInt64: [int, getNullableType<int>()],
|
||||
RepresentationTypeIdentifier.Float32: [double, getNullableType<double>()],
|
||||
RepresentationTypeIdentifier.Float32: [Float32, getNullableType<Float32>()],
|
||||
RepresentationTypeIdentifier.Float64: [double, getNullableType<double>()],
|
||||
RepresentationTypeIdentifier.Decimal: [double, getNullableType<double>()],
|
||||
RepresentationTypeIdentifier.String: [String, getNullableType<String>()],
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,5 @@
|
||||
import 'package:esiur/src/Security/Membership/IMembership.dart';
|
||||
|
||||
import '../../Resource/Template/TemplateDescriber.dart';
|
||||
|
||||
import '../../Resource/IResource.dart';
|
||||
@ -31,4 +33,6 @@ class DistributedServer extends IResource {
|
||||
@override
|
||||
TemplateDescriber get template =>
|
||||
TemplateDescriber("Esiur.Net.IIP.DistributedServer");
|
||||
|
||||
IMembership? membership;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'NetworkBuffer.dart';
|
||||
|
||||
abstract mixin class INetworkReceiver<T>
|
||||
abstract class INetworkReceiver<T>
|
||||
{
|
||||
void networkClose(T sender);
|
||||
void networkReceive(T sender, NetworkBuffer buffer);
|
||||
|
@ -21,51 +21,38 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
import 'package:esiur/esiur.dart';
|
||||
|
||||
import '../../Data/DC.dart';
|
||||
import 'IIPAuthPacketAction.dart';
|
||||
import 'IIPAuthPacketCommand.dart';
|
||||
import '../../Security/Authority/AuthenticationMethod.dart';
|
||||
import 'IIPAuthPacketEvent.dart';
|
||||
|
||||
class IIPAuthPacket {
|
||||
int command = 0;
|
||||
int initialization = 0;
|
||||
int acknowledgement = 0;
|
||||
int action = 0;
|
||||
|
||||
int errorCode = 0;
|
||||
String errorMessage = "";
|
||||
int event = 0;
|
||||
|
||||
AuthenticationMethod localMethod = AuthenticationMethod.None;
|
||||
|
||||
DC? sourceInfo;
|
||||
|
||||
DC? hash;
|
||||
|
||||
DC? sessionId;
|
||||
|
||||
AuthenticationMethod remoteMethod = AuthenticationMethod.None;
|
||||
|
||||
String? domain;
|
||||
int errorCode = 0;
|
||||
String message = "";
|
||||
|
||||
int certificateId = 0;
|
||||
|
||||
String? localUsername;
|
||||
|
||||
String? remoteUsername;
|
||||
|
||||
DC? localPassword;
|
||||
|
||||
DC? remotePassword;
|
||||
|
||||
DC? localToken;
|
||||
|
||||
DC? remoteToken;
|
||||
int publicKeyAlgorithm = 0;
|
||||
int hashAlgorithm = 0;
|
||||
|
||||
DC? certificate;
|
||||
DC? challenge;
|
||||
DC? asymetricEncryptionKey;
|
||||
DC? sessionId;
|
||||
|
||||
DC? localNonce;
|
||||
TransmissionType? dataType;
|
||||
|
||||
DC? remoteNonce;
|
||||
|
||||
int remoteTokenIndex = 0;
|
||||
int reference = 0;
|
||||
|
||||
int _dataLengthNeeded = 0;
|
||||
|
||||
@ -82,157 +69,262 @@ class IIPAuthPacket {
|
||||
}
|
||||
|
||||
int parse(DC data, int offset, int ends) {
|
||||
|
||||
var oOffset = offset;
|
||||
|
||||
if (_notEnough(offset, ends, 1)) return -_dataLengthNeeded;
|
||||
if (_notEnough(offset, ends, 1))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
command = (data[offset] >> 6);
|
||||
|
||||
if (command == IIPAuthPacketCommand.Action) {
|
||||
action = (data[offset++] & 0x3f);
|
||||
if (command == IIPAuthPacketCommand.Initialize) {
|
||||
|
||||
if (action == IIPAuthPacketAction.AuthenticateHash) {
|
||||
if (_notEnough(offset, ends, 32)) return -_dataLengthNeeded;
|
||||
localMethod = AuthenticationMethod.values[((data[offset] >> 4) & 0x3)];
|
||||
remoteMethod = AuthenticationMethod.values[((data[offset] >> 2) & 0x3)];
|
||||
|
||||
hash = data.clip(offset, 32);
|
||||
initialization = (data[offset++] & 0xFC); // remove last two reserved LSBs
|
||||
|
||||
//var hash = new byte[32];
|
||||
//Buffer.BlockCopy(data, (int)offset, hash, 0, 32);
|
||||
//Hash = hash;
|
||||
if (_notEnough(offset, ends, 1))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
offset += 32;
|
||||
} else if (action == IIPAuthPacketAction.NewConnection) {
|
||||
if (_notEnough(offset, ends, 2)) return -_dataLengthNeeded;
|
||||
var parsed = TransmissionType.parse(data, offset, ends);
|
||||
|
||||
var length = data.getUint16(offset);
|
||||
if (parsed.type == null)
|
||||
return -parsed.size;
|
||||
|
||||
offset += 2;
|
||||
dataType = parsed.type;
|
||||
offset += parsed.size;
|
||||
|
||||
if (_notEnough(offset, ends, length)) return -_dataLengthNeeded;
|
||||
|
||||
sourceInfo = data.clip(offset, length);
|
||||
|
||||
//var sourceInfo = new byte[length];
|
||||
//Buffer.BlockCopy(data, (int)offset, sourceInfo, 0, length);
|
||||
//SourceInfo = sourceInfo;
|
||||
|
||||
offset += 32;
|
||||
} else if (action == IIPAuthPacketAction.ResumeConnection ||
|
||||
action == IIPAuthPacketAction.ConnectionEstablished) {
|
||||
//var sessionId = new byte[32];
|
||||
|
||||
if (_notEnough(offset, ends, 32)) return -_dataLengthNeeded;
|
||||
|
||||
sessionId = data.clip(offset, 32);
|
||||
|
||||
//Buffer.BlockCopy(data, (int)offset, sessionId, 0, 32);
|
||||
//SessionId = sessionId;
|
||||
|
||||
offset += 32;
|
||||
}
|
||||
} else if (command == IIPAuthPacketCommand.Declare) {
|
||||
remoteMethod = AuthenticationMethod.values[((data[offset] >> 4) & 0x3)];
|
||||
localMethod = AuthenticationMethod.values[((data[offset] >> 2) & 0x3)];
|
||||
var encrypt = ((data[offset++] & 0x2) == 0x2);
|
||||
|
||||
if (_notEnough(offset, ends, 1)) return -_dataLengthNeeded;
|
||||
|
||||
var domainLength = data[offset++];
|
||||
if (_notEnough(offset, ends, domainLength)) return -_dataLengthNeeded;
|
||||
|
||||
var domain = data.getString(offset, domainLength);
|
||||
|
||||
this.domain = domain;
|
||||
|
||||
offset += domainLength;
|
||||
|
||||
if (remoteMethod == AuthenticationMethod.Credentials) {
|
||||
if (localMethod == AuthenticationMethod.None) {
|
||||
if (_notEnough(offset, ends, 33)) return -_dataLengthNeeded;
|
||||
|
||||
remoteNonce = data.clip(offset, 32);
|
||||
|
||||
offset += 32;
|
||||
|
||||
var length = data[offset++];
|
||||
|
||||
if (_notEnough(offset, ends, length)) return -_dataLengthNeeded;
|
||||
|
||||
remoteUsername = data.getString(offset, length);
|
||||
|
||||
offset += length;
|
||||
}
|
||||
} else if (remoteMethod == AuthenticationMethod.Token) {
|
||||
if (localMethod == AuthenticationMethod.None) {
|
||||
if (_notEnough(offset, ends, 40)) return -_dataLengthNeeded;
|
||||
|
||||
remoteNonce = data.clip(offset, 32);
|
||||
|
||||
offset += 32;
|
||||
|
||||
remoteTokenIndex = data.getUint64(offset);
|
||||
offset += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (encrypt) {
|
||||
if (_notEnough(offset, ends, 2)) return -_dataLengthNeeded;
|
||||
|
||||
var keyLength = data.getUint16(offset);
|
||||
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, keyLength)) return -_dataLengthNeeded;
|
||||
|
||||
asymetricEncryptionKey = data.clip(offset, keyLength);
|
||||
|
||||
offset += keyLength;
|
||||
}
|
||||
} else if (command == IIPAuthPacketCommand.Acknowledge) {
|
||||
remoteMethod = AuthenticationMethod.values[((data[offset] >> 4) & 0x3)];
|
||||
localMethod = AuthenticationMethod.values[((data[offset] >> 2) & 0x3)];
|
||||
var encrypt = ((data[offset++] & 0x2) == 0x2);
|
||||
|
||||
if (remoteMethod == AuthenticationMethod.None) {
|
||||
if (localMethod == AuthenticationMethod.None) {
|
||||
// do nothing
|
||||
}
|
||||
} else if (remoteMethod == AuthenticationMethod.Credentials ||
|
||||
remoteMethod == AuthenticationMethod.Token) {
|
||||
if (localMethod == AuthenticationMethod.None) {
|
||||
if (_notEnough(offset, ends, 32)) return -_dataLengthNeeded;
|
||||
localMethod = AuthenticationMethod.values[((data[offset] >> 4) & 0x3)];
|
||||
remoteMethod = AuthenticationMethod.values[((data[offset] >> 2) & 0x3)];
|
||||
|
||||
remoteNonce = data.clip(offset, 32);
|
||||
offset += 32;
|
||||
}
|
||||
}
|
||||
acknowledgement =
|
||||
(data[offset++] & 0xFC); // remove last two reserved LSBs
|
||||
|
||||
if (encrypt) {
|
||||
if (_notEnough(offset, ends, 2)) return -_dataLengthNeeded;
|
||||
if (_notEnough(offset, ends, 1))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
var parsed = TransmissionType.parse(data, offset, ends);
|
||||
|
||||
if (parsed.type == null)
|
||||
return -parsed.size;
|
||||
|
||||
dataType = parsed.type;
|
||||
offset += parsed.size;
|
||||
|
||||
} else if (command == IIPAuthPacketCommand.Action) {
|
||||
|
||||
action = (data[offset++]);
|
||||
if (action == IIPAuthPacketAction.AuthenticateHash ||
|
||||
action == IIPAuthPacketAction.AuthenticatePublicHash ||
|
||||
action == IIPAuthPacketAction.AuthenticatePrivateHash ||
|
||||
action == IIPAuthPacketAction.AuthenticatePublicPrivateHash) {
|
||||
|
||||
if (_notEnough(offset, ends, 3))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
hashAlgorithm = data[offset++];
|
||||
|
||||
var hashLength = data.getUint16(offset);
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, hashLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
challenge = data.clip(offset, hashLength);
|
||||
offset += hashLength;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.AuthenticatePrivateHashCert ||
|
||||
action == IIPAuthPacketAction.AuthenticatePublicPrivateHashCert) {
|
||||
|
||||
if (_notEnough(offset, ends, 3))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
hashAlgorithm = data[offset++];
|
||||
|
||||
var hashLength = data.getUint16(offset);
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, hashLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
challenge = data.clip(offset, hashLength);
|
||||
offset += hashLength;
|
||||
|
||||
if (_notEnough(offset, ends, 2))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
var certLength = data.getUint16(offset);
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, certLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
certificate = data.clip(offset, certLength);
|
||||
|
||||
offset += certLength;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.IAuthPlain) {
|
||||
|
||||
if (_notEnough(offset, ends, 5))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
reference = data.getUint32(offset);
|
||||
offset += 4;
|
||||
|
||||
var parsed = TransmissionType.parse(data, offset, ends);
|
||||
|
||||
if (parsed.type == null)
|
||||
return -parsed.size;
|
||||
|
||||
dataType = parsed.type;
|
||||
offset += parsed.size;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.IAuthHashed) {
|
||||
|
||||
if (_notEnough(offset, ends, 7))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
reference = data.getUint32(offset);
|
||||
offset += 4;
|
||||
|
||||
hashAlgorithm = data[offset++];
|
||||
|
||||
var cl = data.getUint16(offset);
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, cl))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
challenge = data.clip(offset, cl);
|
||||
|
||||
offset += cl;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.IAuthEncrypted) {
|
||||
|
||||
if (_notEnough(offset, ends, 7))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
reference = data.getUint32(offset);
|
||||
offset += 4;
|
||||
|
||||
publicKeyAlgorithm = data[offset++];
|
||||
|
||||
var cl = data.getUint16(offset);
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, cl))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
challenge = data.clip(offset, cl);
|
||||
|
||||
offset += cl;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.EstablishNewSession) {
|
||||
// Nothing here
|
||||
} else if (action == IIPAuthPacketAction.EstablishResumeSession) {
|
||||
|
||||
if (_notEnough(offset, ends, 1))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
var sessionLength = data[offset++];
|
||||
|
||||
if (_notEnough(offset, ends, sessionLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
sessionId = data.clip(offset, sessionLength);
|
||||
|
||||
offset += sessionLength;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.EncryptKeyExchange) {
|
||||
|
||||
if (_notEnough(offset, ends, 2))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
var keyLength = data.getUint16(offset);
|
||||
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, keyLength)) return -_dataLengthNeeded;
|
||||
if (_notEnough(offset, ends, keyLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
asymetricEncryptionKey = data.clip(offset, keyLength);
|
||||
|
||||
offset += keyLength;
|
||||
|
||||
} else if (action == IIPAuthPacketAction.RegisterEndToEndKey ||
|
||||
action == IIPAuthPacketAction.RegisterHomomorphic) {
|
||||
|
||||
if (_notEnough(offset, ends, 3))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
publicKeyAlgorithm = data[offset++];
|
||||
|
||||
var keyLength = data.getUint16(offset);
|
||||
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, keyLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
asymetricEncryptionKey = data.clip(offset, keyLength);
|
||||
|
||||
offset += keyLength;
|
||||
|
||||
}
|
||||
} else if (command == IIPAuthPacketCommand.Error) {
|
||||
if (_notEnough(offset, ends, 4)) return -_dataLengthNeeded;
|
||||
} else if (command == IIPAuthPacketCommand.Event) {
|
||||
|
||||
offset++;
|
||||
errorCode = data[offset++];
|
||||
event = data[offset++];
|
||||
|
||||
var cl = data.getUint16(offset);
|
||||
offset += 2;
|
||||
if (event == IIPAuthPacketEvent.ErrorTerminate ||
|
||||
event == IIPAuthPacketEvent.ErrorMustEncrypt ||
|
||||
event == IIPAuthPacketEvent.ErrorRetry) {
|
||||
|
||||
if (_notEnough(offset, ends, cl)) return -_dataLengthNeeded;
|
||||
if (_notEnough(offset, ends, 3))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
errorMessage = data.getString(offset, cl);
|
||||
offset += cl;
|
||||
errorCode = data[offset++];
|
||||
var msgLength = data.getUint16(offset);
|
||||
offset += 2;
|
||||
|
||||
if (_notEnough(offset, ends, msgLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
message = data.getString(offset, msgLength);
|
||||
|
||||
offset += msgLength;
|
||||
|
||||
} else if (event == IIPAuthPacketEvent.IndicationEstablished) {
|
||||
|
||||
if (_notEnough(offset, ends, 1))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
var sessionLength = data[offset++];
|
||||
|
||||
if (_notEnough(offset, ends, sessionLength))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
sessionId = data.clip(offset, sessionLength);
|
||||
|
||||
offset += sessionLength;
|
||||
|
||||
} else if (event == IIPAuthPacketEvent.IAuthPlain ||
|
||||
event == IIPAuthPacketEvent.IAuthHashed ||
|
||||
event == IIPAuthPacketEvent.IAuthEncrypted) {
|
||||
|
||||
if (_notEnough(offset, ends, 1))
|
||||
return -_dataLengthNeeded;
|
||||
|
||||
var parsed = TransmissionType.parse(data, offset, ends);
|
||||
|
||||
if (parsed.type == null)
|
||||
return -parsed.size;
|
||||
|
||||
dataType = parsed.type;
|
||||
offset += parsed.size;
|
||||
}
|
||||
}
|
||||
|
||||
return offset - oOffset;
|
||||
|
19
lib/src/Net/Packets/IIPAuthPacketAcknowledge.dart
Normal file
19
lib/src/Net/Packets/IIPAuthPacketAcknowledge.dart
Normal file
@ -0,0 +1,19 @@
|
||||
class IIPAuthPacketAcknowledge
|
||||
{
|
||||
static const int NoAuthNoAuth = 0x40; // 0b01000000,
|
||||
static const int NoAuthCredentials = 0x44; // 0b01000100,
|
||||
static const int NoAuthToken = 0x48; //0b01001000,
|
||||
static const int NoAuthCertificate = 0x4c; //0b01001100,
|
||||
static const int CredentialsNoAuth = 0x50; //0b01010000,
|
||||
static const int CredentialsCredentials = 0x54; //0b01010100,
|
||||
static const int CredentialsToken = 0x58; //0b01011000,
|
||||
static const int CredentialsCertificate = 0x5c; //0b01011100,
|
||||
static const int TokenNoAuth = 0x60; //0b01100000,
|
||||
static const int TokenCredentials = 0x64; //0b01100100,
|
||||
static const int TokenToken = 0x68; //0b01101000,
|
||||
static const int TokenCertificate = 0x6c; //0b01101100,
|
||||
static const int CertificateNoAuth = 0x70; //0b01110000,
|
||||
static const int CertificateCredentials = 0x74; //0b01110100,
|
||||
static const int CertificateToken = 0x78; //0b01111000,
|
||||
static const int CertificateCertificate = 0x7c; // 0b01111100,
|
||||
}
|
@ -1,16 +1,27 @@
|
||||
class IIPAuthPacketAction
|
||||
{
|
||||
// Authenticate
|
||||
static const int AuthenticateHash = 0;
|
||||
|
||||
|
||||
//Challenge,
|
||||
//CertificateRequest,
|
||||
//CertificateReply,
|
||||
//EstablishRequest,
|
||||
//EstablishReply
|
||||
|
||||
static const int NewConnection = 0x20;
|
||||
static const int ResumeConnection = 0x21;
|
||||
static const int ConnectionEstablished = 0x28;
|
||||
|
||||
static const int AuthenticateHash = 0x80;
|
||||
static const int AuthenticatePublicHash = 0x81;
|
||||
static const int AuthenticatePrivateHash = 0x82;
|
||||
static const int AuthenticatePublicPrivateHash = 0x83;
|
||||
|
||||
static const int AuthenticatePrivateHashCert = 0x88;
|
||||
static const int AuthenticatePublicPrivateHashCert = 0x89;
|
||||
|
||||
static const int IAuthPlain = 0x90;
|
||||
static const int IAuthHashed = 0x91;
|
||||
static const int IAuthEncrypted = 0x92;
|
||||
|
||||
|
||||
static const int EstablishNewSession = 0x98;
|
||||
static const int EstablishResumeSession = 0x99;
|
||||
|
||||
static const int EncryptKeyExchange = 0xA0;
|
||||
|
||||
static const int RegisterEndToEndKey = 0xA8;
|
||||
static const int RegisterHomomorphic = 0xA9;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
class IIPAuthPacketCommand
|
||||
{
|
||||
static const int Action = 0;
|
||||
static const int Declare = 1;
|
||||
static const int Acknowledge = 2;
|
||||
static const int Error = 3;
|
||||
static const int Initialize = 0x0;
|
||||
static const int Acknowledge = 0x1;
|
||||
static const int Action = 0x2;
|
||||
static const int Event = 0x3;
|
||||
}
|
12
lib/src/Net/Packets/IIPAuthPacketEvent.dart
Normal file
12
lib/src/Net/Packets/IIPAuthPacketEvent.dart
Normal file
@ -0,0 +1,12 @@
|
||||
class IIPAuthPacketEvent
|
||||
{
|
||||
static const int ErrorTerminate = 0xC0;
|
||||
static const int ErrorMustEncrypt = 0xC1;
|
||||
static const int ErrorRetry = 0xC2;
|
||||
|
||||
static const int IndicationEstablished = 0xC8;
|
||||
|
||||
static const int IAuthPlain = 0xD0;
|
||||
static const int IAuthHashed = 0xD1;
|
||||
static const int IAuthEncrypted = 0xD2;
|
||||
}
|
6
lib/src/Net/Packets/IIPAuthPacketHashAlgorithm.dart
Normal file
6
lib/src/Net/Packets/IIPAuthPacketHashAlgorithm.dart
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
class IIPAuthPacketHashAlgorithm
|
||||
{
|
||||
static int SHA256 = 0x0;
|
||||
static int SHA3 = 0x1;
|
||||
}
|
25
lib/src/Net/Packets/IIPAuthPacketHeader.dart
Normal file
25
lib/src/Net/Packets/IIPAuthPacketHeader.dart
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
import '../../Data/IntType.dart';
|
||||
|
||||
class IIPAuthPacketHeader
|
||||
{
|
||||
static UInt8 Version = UInt8(0);
|
||||
static UInt8 Domain = UInt8(1);
|
||||
static UInt8 SupportedAuthentications = UInt8(2);
|
||||
static UInt8 SupportedHashAlgorithms = UInt8(3);
|
||||
static UInt8 SupportedCiphers = UInt8(4);
|
||||
static UInt8 SupportedCompression = UInt8(5);
|
||||
static UInt8 SupportedPersonalAuth = UInt8(6);
|
||||
static UInt8 Nonce = UInt8(7);
|
||||
static UInt8 Username = UInt8(8);
|
||||
static UInt8 TokenIndex = UInt8(9);
|
||||
static UInt8 CertificateId = UInt8(10);
|
||||
static UInt8 CachedCertificates = UInt8(11);
|
||||
static UInt8 CipherType = UInt8(12);
|
||||
static UInt8 CipherKey = UInt8(13);
|
||||
static UInt8 SoftwareIdentity = UInt8(14);
|
||||
static UInt8 Referrer = UInt8(15);
|
||||
static UInt8 Time = UInt8(16);
|
||||
static UInt8 Certificate = UInt8(17);
|
||||
static UInt8 IPv4 = UInt8(18);
|
||||
}
|
9
lib/src/Net/Packets/IIPAuthPacketIAuthDestination.dart
Normal file
9
lib/src/Net/Packets/IIPAuthPacketIAuthDestination.dart
Normal file
@ -0,0 +1,9 @@
|
||||
class IIPAuthPacketIAuthDestination
|
||||
{
|
||||
static int Self = 0;
|
||||
static int Device = 1; // logged in device
|
||||
static int Email = 2;
|
||||
static int SMS = 3;
|
||||
static int App = 4; // Authenticator app
|
||||
static int ThirdParty = 5; // usualy a second person
|
||||
}
|
12
lib/src/Net/Packets/IIPAuthPacketIAuthFormat.dart
Normal file
12
lib/src/Net/Packets/IIPAuthPacketIAuthFormat.dart
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
class IIPAuthPacketIAuthFormat
|
||||
{
|
||||
static int None = 0;
|
||||
static int Number = 1;
|
||||
static int Text = 2;
|
||||
static int LowercaseText = 3;
|
||||
static int Choice = 4;
|
||||
static int Photo = 5;
|
||||
static int Signature = 6;
|
||||
static int Fingerprint = 7;
|
||||
}
|
11
lib/src/Net/Packets/IIPAuthPacketIAuthHeader.dart
Normal file
11
lib/src/Net/Packets/IIPAuthPacketIAuthHeader.dart
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
class IIPAuthPacketIAuthHeader
|
||||
{
|
||||
static int Reference = 0;
|
||||
static int Destination = 1;
|
||||
static int Clue = 2;
|
||||
static int RequiredFormat = 3;
|
||||
static int ContentFormat = 4;
|
||||
static int Content = 5;
|
||||
static int Timeout = 6;
|
||||
}
|
19
lib/src/Net/Packets/IIPAuthPacketInitialize.dart
Normal file
19
lib/src/Net/Packets/IIPAuthPacketInitialize.dart
Normal file
@ -0,0 +1,19 @@
|
||||
class IIPAuthPacketInitialize
|
||||
{
|
||||
static int NoAuthNoAuth = 0x0; //0b00000000,
|
||||
static int NoAuthCredentials = 0x4; //0b00000100,
|
||||
static int NoAuthToken = 0x8; //0b00001000,
|
||||
static int NoAuthCertificate = 0xC; //0b00001100,
|
||||
static int CredentialsNoAuth = 0x10; //0b00010000,
|
||||
static int CredentialsCredentials = 0x14; //0b00010100,
|
||||
static int CredentialsToken = 0x18; //0b00011000,
|
||||
static int CredentialsCertificate = 0x1c; //0b00011100,
|
||||
static int TokenNoAuth = 0x20; //0b00100000,
|
||||
static int TokenCredentials = 0x24; //0b00100100,
|
||||
static int TokenToken = 0x28; //0b00101000,
|
||||
static int TokenCertificate = 0x2c; //0b00101100,
|
||||
static int CertificateNoAuth = 0x30; //0b00110000,
|
||||
static int CertificateCredentials = 0x34; // 0b00110100,
|
||||
static int CertificateToken = 0x38; //0b00111000,
|
||||
static int CertificateCertificate = 0x3c; //0b00111100,
|
||||
}
|
6
lib/src/Net/Packets/IIPAuthPacketPublicKeyAlgorithm.dart
Normal file
6
lib/src/Net/Packets/IIPAuthPacketPublicKeyAlgorithm.dart
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
class IIPAuthPacketPublicKeyAlgorithm
|
||||
{
|
||||
static int RSA = 0;
|
||||
static int CKKS = 1;
|
||||
}
|
@ -209,22 +209,22 @@ class TemplateGenerator {
|
||||
name = "double";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.Float32:
|
||||
name = "double";
|
||||
name = "Float32";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.Float64:
|
||||
name = "double";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.Int16:
|
||||
name = "int";
|
||||
name = "Int16";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.Int32:
|
||||
name = "int";
|
||||
name = "Int32";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.Int64:
|
||||
name = "int";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.Int8:
|
||||
name = "int";
|
||||
name = "Int8";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.String:
|
||||
name = "String";
|
||||
@ -233,16 +233,16 @@ class TemplateGenerator {
|
||||
name = "Map";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.UInt16:
|
||||
name = "int";
|
||||
name = "UInt16";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.UInt32:
|
||||
name = "int";
|
||||
name = "UInt32";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.UInt64:
|
||||
name = "int";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.UInt8:
|
||||
name = "int";
|
||||
name = "UInt8";
|
||||
break;
|
||||
case RepresentationTypeIdentifier.List:
|
||||
name = "List";
|
||||
|
@ -14,6 +14,7 @@ class FactoryEntry<T> {
|
||||
final Function instanceCreator;
|
||||
final Function arrayCreator = () => <T>[];
|
||||
final RepresentationType representationType;
|
||||
final Function mapCreator = () => Map<T, dynamic>();
|
||||
|
||||
bool isMapKeySubType(Map map) {
|
||||
return map is Map<T, dynamic>;
|
||||
|
@ -31,7 +31,7 @@ import '../Data/PropertyValue.dart';
|
||||
// old
|
||||
// abstract class IStore extends IResource
|
||||
// new
|
||||
abstract mixin class IStore implements IResource {
|
||||
abstract class IStore implements IResource {
|
||||
AsyncReply<IResource?> get(String path);
|
||||
// AsyncReply<IResource?> retrieve(int iid);
|
||||
AsyncReply<bool> put(IResource resource);
|
||||
|
@ -482,7 +482,8 @@ class Instance extends IEventHandler {
|
||||
|
||||
if (pi.parents.count == 0) break;
|
||||
|
||||
p = pi.parents.firstOrNull!;
|
||||
p = pi.parents.first;
|
||||
|
||||
}
|
||||
|
||||
return l.join("/");
|
||||
|
@ -510,6 +510,11 @@ class Warehouse {
|
||||
return _factory[type]?.arrayCreator.call() as List<T>;
|
||||
}
|
||||
|
||||
static Map<T, dynamic> createMap<T>(Type keyType) {
|
||||
return _factory[keyType]?.mapCreator.call() as Map<T, dynamic>;
|
||||
}
|
||||
|
||||
|
||||
static AsyncReply<T> newResource<T extends IResource>(String name,
|
||||
[IStore? store = null,
|
||||
IResource? parent = null,
|
||||
@ -759,6 +764,8 @@ class Warehouse {
|
||||
RepresentationType(RepresentationTypeIdentifier.Int64, false)))
|
||||
..addAll(_getTypeEntries<bool>(() => false,
|
||||
RepresentationType(RepresentationTypeIdentifier.Bool, false)))
|
||||
..addAll(_getTypeEntries<Float32>(() => 0.0,
|
||||
RepresentationType(RepresentationTypeIdentifier.Float64, false)))
|
||||
..addAll(_getTypeEntries<double>(() => 0.0,
|
||||
RepresentationType(RepresentationTypeIdentifier.Float64, false)))
|
||||
..addAll(_getTypeEntries<String>(() => "",
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
enum AuthenticationMethod
|
||||
{
|
||||
None,
|
||||
Certificate,
|
||||
Credentials,
|
||||
Token,
|
||||
None,
|
||||
Credentials,
|
||||
Token,
|
||||
Certificate
|
||||
}
|
@ -21,32 +21,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import '../../Data/DC.dart';
|
||||
import 'Authentication.dart';
|
||||
import '../../Data/IntType.dart';
|
||||
import '../../Data/KeyList.dart';
|
||||
import 'AuthenticationMethod.dart';
|
||||
import 'AuthenticationType.dart';
|
||||
|
||||
class Session
|
||||
{
|
||||
Authentication get localAuthentication => _localAuth;
|
||||
Authentication get remoteAuthentication => _remoteAuth;
|
||||
|
||||
// public Source Source { get; }
|
||||
DC? id;
|
||||
|
||||
//DateTime get creation => _creation;
|
||||
|
||||
//public DateTime Modification { get; }
|
||||
DateTime creation = DateTime.now();
|
||||
DateTime modification = DateTime.now();
|
||||
|
||||
final KeyList<String, dynamic> variables = new KeyList<String, dynamic>();
|
||||
|
||||
//KeyList<string, object> Variables { get; }
|
||||
//IStore Store { get; }
|
||||
Map<UInt8, dynamic> localHeaders = Map<UInt8, dynamic>();
|
||||
Map<UInt8, dynamic> remoteHeaders = Map<UInt8, dynamic>();
|
||||
|
||||
//string id;
|
||||
Authentication _localAuth, _remoteAuth;
|
||||
|
||||
AuthenticationMethod localMethod = AuthenticationMethod.None;
|
||||
AuthenticationMethod remoteMethod = AuthenticationMethod.None;
|
||||
|
||||
Session(this._localAuth, this._remoteAuth)
|
||||
{
|
||||
|
||||
}
|
||||
AuthenticationType authenticationType = AuthenticationType.Host ;
|
||||
|
||||
String? authorizedAccount;
|
||||
}
|
||||
|
18
lib/src/Security/Membership/AuthorizationResults.dart
Normal file
18
lib/src/Security/Membership/AuthorizationResults.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import '../../Net/Packets/IIPAuthPacketIAuthDestination.dart';
|
||||
import '../../Net/Packets/IIPAuthPacketIAuthFormat.dart';
|
||||
import 'AuthorizationResultsResponse.dart';
|
||||
|
||||
class AuthorizationResults
|
||||
{
|
||||
AuthorizationResultsResponse response = AuthorizationResultsResponse.Failed;
|
||||
int destination = IIPAuthPacketIAuthDestination.Self;
|
||||
int requiredFormat = IIPAuthPacketIAuthFormat.None ;
|
||||
String clue = "";
|
||||
|
||||
int timeout = 0; // 0 means no timeout
|
||||
int reference = 0;
|
||||
|
||||
DateTime issue = DateTime.now();
|
||||
|
||||
//bool expired => timeout == 0 ? false : (DateTime.UtcNow - Issue).TotalSeconds > Timeout;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
enum AuthorizationResultsResponse
|
||||
{
|
||||
Success,
|
||||
Failed,
|
||||
Expired,
|
||||
ServiceUnavailable,
|
||||
IAuthPlain,
|
||||
IAuthHashed,
|
||||
IAuthEncrypted
|
||||
}
|
26
lib/src/Security/Membership/IMembership.dart
Normal file
26
lib/src/Security/Membership/IMembership.dart
Normal file
@ -0,0 +1,26 @@
|
||||
import '../../Core/AsyncReply.dart';
|
||||
import '../../Data/DC.dart';
|
||||
import '../../Net/Packets/IIPAuthPacketHashAlgorithm.dart';
|
||||
import '../Authority/Session.dart';
|
||||
import 'AuthorizationResults.dart';
|
||||
|
||||
abstract class IMembership
|
||||
{
|
||||
//public event ResourceEventHandler<AuthorizationIndication> Authorization;
|
||||
|
||||
AsyncReply<String?> userExists(String username, String domain);
|
||||
AsyncReply<String?> tokenExists(int tokenIndex, String domain);
|
||||
|
||||
AsyncReply<DC?> getPassword(String username, String domain);
|
||||
AsyncReply<DC?> getToken(String tokenIndex, String domain);
|
||||
AsyncReply<AuthorizationResults> authorize(Session session);
|
||||
AsyncReply<AuthorizationResults> authorizePlain(Session session, int reference, value);
|
||||
AsyncReply<AuthorizationResults> authorizeHashed(Session session, int reference, int algorithm, DC value);
|
||||
AsyncReply<AuthorizationResults> authorizeEncrypted(Session session, int reference, int algorithm, DC value);
|
||||
|
||||
AsyncReply<bool> login(Session session);
|
||||
AsyncReply<bool> logout(Session session);
|
||||
bool get guestsAllowed;
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
name: esiur
|
||||
description: Distributed Object Framework.
|
||||
version: 2.1.6
|
||||
version: 2.2.0
|
||||
#author: Ahmed Zamil <ahmed@esiur.com>
|
||||
homepage: https://github.com/esiur/esiur-dart
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user