mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 12:02:57 +00:00
iAuth
This commit is contained in:
parent
09c730ebc4
commit
3087e0d1ad
File diff suppressed because it is too large
Load Diff
@ -87,7 +87,7 @@ class DistributedResource extends IResource {
|
|||||||
void destroy() {
|
void destroy() {
|
||||||
_destroyed = true;
|
_destroyed = true;
|
||||||
_attached = false;
|
_attached = false;
|
||||||
_connection?.detachResource(_instanceId as int);
|
_connection?.sendDetachRequest(_instanceId as int);
|
||||||
emitArgs("destroy", [this]);
|
emitArgs("destroy", [this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,12 +391,7 @@ class DistributedResource extends IResource {
|
|||||||
var reply = new AsyncReply<dynamic>();
|
var reply = new AsyncReply<dynamic>();
|
||||||
var con = _connection as DistributedConnection;
|
var con = _connection as DistributedConnection;
|
||||||
|
|
||||||
var parameters = Codec.compose(value, con);
|
con.sendSetProperty(_instanceId as int, index, value)
|
||||||
(con.sendRequest(IIPPacketAction.SetProperty)
|
|
||||||
..addUint32(_instanceId as int)
|
|
||||||
..addUint8(index)
|
|
||||||
..addDC(parameters))
|
|
||||||
.done()
|
|
||||||
..then((res) {
|
..then((res) {
|
||||||
// not really needed, server will always send property modified,
|
// not really needed, server will always send property modified,
|
||||||
// this only happens if the programmer forgot to emit in property setter
|
// this only happens if the programmer forgot to emit in property setter
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
|
import '../../Data/IntType.dart';
|
||||||
|
|
||||||
class IIPAuthPacketIAuthHeader
|
class IIPAuthPacketIAuthHeader {
|
||||||
{
|
static UInt8 Reference = UInt8(0);
|
||||||
static int Reference = 0;
|
static UInt8 Destination = UInt8(1);
|
||||||
static int Destination = 1;
|
static UInt8 Clue = UInt8(2);
|
||||||
static int Clue = 2;
|
static UInt8 RequiredFormat = UInt8(3);
|
||||||
static int RequiredFormat = 3;
|
static UInt8 ContentFormat = UInt8(4);
|
||||||
static int ContentFormat = 4;
|
static UInt8 Content = UInt8(5);
|
||||||
static int Content = 5;
|
static UInt8 Trials = UInt8(6);
|
||||||
static int Timeout = 6;
|
static UInt8 Issue = UInt8(7);
|
||||||
|
static UInt8 Expire = UInt8(8);
|
||||||
}
|
}
|
44
lib/src/Security/Membership/AuthorizationRequest.dart
Normal file
44
lib/src/Security/Membership/AuthorizationRequest.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import 'package:esiur/esiur.dart';
|
||||||
|
|
||||||
|
import '../../Net/Packets/IIPAuthPacketIAuthDestination.dart';
|
||||||
|
import '../../Net/Packets/IIPAuthPacketIAuthFormat.dart';
|
||||||
|
import '../../Net/Packets/IIPAuthPacketIAuthHeader.dart';
|
||||||
|
|
||||||
|
class AuthorizationRequest {
|
||||||
|
int reference = 0;
|
||||||
|
int destination = IIPAuthPacketIAuthDestination.Self;
|
||||||
|
String? clue;
|
||||||
|
|
||||||
|
IIPAuthPacketIAuthFormat? requiredFormat;
|
||||||
|
IIPAuthPacketIAuthFormat? contentFormat;
|
||||||
|
dynamic content;
|
||||||
|
|
||||||
|
int? trials;
|
||||||
|
|
||||||
|
DateTime? issue;
|
||||||
|
DateTime? expire;
|
||||||
|
|
||||||
|
int get timeout =>
|
||||||
|
expire != null ? DateTime.now().difference(expire!).inSeconds : 0;
|
||||||
|
|
||||||
|
AuthorizationRequest(Map<UInt8, dynamic> headers) {
|
||||||
|
reference = headers[IIPAuthPacketIAuthHeader.Reference];
|
||||||
|
destination = headers[IIPAuthPacketIAuthHeader.Destination];
|
||||||
|
clue = headers[IIPAuthPacketIAuthHeader.Clue];
|
||||||
|
|
||||||
|
if (headers.containsKey(IIPAuthPacketIAuthHeader.RequiredFormat))
|
||||||
|
requiredFormat = headers[IIPAuthPacketIAuthHeader.RequiredFormat];
|
||||||
|
|
||||||
|
if (headers.containsKey(IIPAuthPacketIAuthHeader.ContentFormat))
|
||||||
|
contentFormat = headers[IIPAuthPacketIAuthHeader.ContentFormat];
|
||||||
|
|
||||||
|
if (headers.containsKey(IIPAuthPacketIAuthHeader.Content))
|
||||||
|
content = headers[IIPAuthPacketIAuthHeader.Content];
|
||||||
|
|
||||||
|
if (headers.containsKey(IIPAuthPacketIAuthHeader.Trials))
|
||||||
|
trials = headers[IIPAuthPacketIAuthHeader.Trials];
|
||||||
|
|
||||||
|
if (headers.containsKey(IIPAuthPacketIAuthHeader.Expire))
|
||||||
|
expire = headers[IIPAuthPacketIAuthHeader.Expire];
|
||||||
|
}
|
||||||
|
}
|
@ -2,17 +2,22 @@ import '../../Net/Packets/IIPAuthPacketIAuthDestination.dart';
|
|||||||
import '../../Net/Packets/IIPAuthPacketIAuthFormat.dart';
|
import '../../Net/Packets/IIPAuthPacketIAuthFormat.dart';
|
||||||
import 'AuthorizationResultsResponse.dart';
|
import 'AuthorizationResultsResponse.dart';
|
||||||
|
|
||||||
class AuthorizationResults
|
class AuthorizationResults {
|
||||||
{
|
AuthorizationResultsResponse response = AuthorizationResultsResponse.Failed;
|
||||||
AuthorizationResultsResponse response = AuthorizationResultsResponse.Failed;
|
|
||||||
int destination = IIPAuthPacketIAuthDestination.Self;
|
|
||||||
int requiredFormat = IIPAuthPacketIAuthFormat.None ;
|
|
||||||
String clue = "";
|
|
||||||
|
|
||||||
int timeout = 0; // 0 means no timeout
|
int reference = 0;
|
||||||
int reference = 0;
|
int destination = IIPAuthPacketIAuthDestination.Self;
|
||||||
|
String? clue;
|
||||||
|
|
||||||
DateTime issue = DateTime.now();
|
IIPAuthPacketIAuthFormat? requiredFormat;
|
||||||
|
IIPAuthPacketIAuthFormat? contentFormat;
|
||||||
|
dynamic content;
|
||||||
|
|
||||||
//bool expired => timeout == 0 ? false : (DateTime.UtcNow - Issue).TotalSeconds > Timeout;
|
int? trials;
|
||||||
}
|
|
||||||
|
DateTime? issue;
|
||||||
|
DateTime? expire;
|
||||||
|
|
||||||
|
int get timeout =>
|
||||||
|
expire != null ? DateTime.now().difference(expire!).inSeconds : 0;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user