Reserve(DateTime?StartTime = null,
                TimeSpan?Duration  = null,
                ChargingReservation_Id?ReservationId      = null,
                eMobilityProvider_Id?ProviderId           = null,
                RemoteAuthentication RemoteAuthentication = null,
                ChargingProduct ChargingProduct           = null,
                IEnumerable <Auth_Token> AuthTokens       = null,
                IEnumerable <eMobilityAccount_Id> eMAIds  = null,
                IEnumerable <UInt32> PINs = null,

                DateTime?Timestamp = null,
                CancellationToken?CancellationToken = null,
                EventTracking_Id EventTrackingId    = null,
                TimeSpan?RequestTimeout             = null)


        => Reserve(ChargingLocation.FromEVSEId(Id),
                   ChargingReservationLevel.EVSE,
                   StartTime,
                   Duration,
                   ReservationId,
                   ProviderId,
                   RemoteAuthentication,
                   ChargingProduct,
                   AuthTokens,
                   eMAIds,
                   PINs,

                   Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout);
        RemoteStop(ChargingSession_Id SessionId,
                   ReservationHandling?ReservationHandling   = null,
                   eMobilityProvider_Id?ProviderId           = null,
                   RemoteAuthentication RemoteAuthentication = null,

                   DateTime?Timestamp = null,
                   CancellationToken?CancellationToken = null,
                   EventTracking_Id EventTrackingId    = null,
                   TimeSpan?RequestTimeout             = null)

        {
            if (_ANetworkChargingStation == null)
            {
                return(RemoteStopResult.OutOfService(SessionId));
            }

            return(await _ANetworkChargingStation.
                   RemoteStop(SessionId,
                              ReservationHandling,
                              ProviderId,
                              RemoteAuthentication,

                              Timestamp,
                              CancellationToken,
                              EventTrackingId,
                              RequestTimeout));
        }
        RemoteStart(ChargingLocation ChargingLocation,
                    ChargingProduct ChargingProduct           = null,
                    ChargingReservation_Id?ReservationId      = null,
                    ChargingSession_Id?SessionId              = null,
                    eMobilityProvider_Id?ProviderId           = null,
                    RemoteAuthentication RemoteAuthentication = null,

                    DateTime?Timestamp = null,
                    CancellationToken?CancellationToken = null,
                    EventTracking_Id EventTrackingId    = null,
                    TimeSpan?RequestTimeout             = null)
        {
            if (_ANetworkChargingStation == null)
            {
                return(RemoteStartResult.OutOfService);
            }

            return(await _ANetworkChargingStation.
                   RemoteStart(ChargingLocation.FromEVSEId(Id),
                               ChargingProduct,
                               ReservationId,
                               SessionId,
                               ProviderId,
                               RemoteAuthentication,

                               Timestamp,
                               CancellationToken,
                               EventTrackingId,
                               RequestTimeout));
        }
Exemple #4
0
 public override void updateRecord(RemoteAuthentication remoteAuth)
 {
     // create necessary records
     if (serverContext.userManager.findByUid(remoteAuth.user.uuid) == null)
     {
         serverContext.userManager.register(remoteAuth.user);
     }
 }
Exemple #5
0
 public RemoteAuthenticationManageModel(RemoteAuthentication remoteAuthentication)
     : this()
 {
     Id            = remoteAuthentication.Id;
     Name          = remoteAuthentication.Name;
     ServiceUrl    = remoteAuthentication.ServiceUrl;
     AuthorizeCode = remoteAuthentication.AuthorizeCode;
     RecordOrder   = remoteAuthentication.RecordOrder;
 }
Exemple #6
0
 public void NpcapDeviceListNullAuthTest()
 {
     using (new RemotePcapServer(NullAuthArgs))
     {
         var auth = new RemoteAuthentication(AuthenticationTypes.Null, null, null);
         CollectionAssert.IsNotEmpty(NpcapDeviceList.Devices(IPAddress.Loopback, 2002, auth));
         CollectionAssert.IsNotEmpty(NpcapDeviceList.Devices(IPAddress.Loopback, 2002, null));
     }
 }
 public void NpcapDeviceListNullAuthTest()
 {
     using (new RemotePcapServer(NullAuthArgs))
     {
         var auth     = new RemoteAuthentication(AuthenticationTypes.Null, null, null);
         var loopback = new IPEndPoint(IPAddress.Loopback, 2002);
         CollectionAssert.IsNotEmpty(PcapInterface.GetAllPcapInterfaces(loopback, auth));
         CollectionAssert.IsNotEmpty(PcapInterface.GetAllPcapInterfaces(loopback, null));
     }
 }
Exemple #8
0
 public void PcapInterfaceNullAuthTest(
     [ValueSource(nameof(NullAuthCredentials))] RemoteAuthentication credentials
     )
 {
     using (new RemotePcapServer(NullAuthArgs))
     {
         var list = PcapInterface.GetAllPcapInterfaces(LoopbackSource, credentials);
         CollectionAssert.IsNotEmpty(list);
     }
 }
        public virtual string issueSession(RemoteAuthentication identity)
        {
            // get a session token
            var sessionId = getSessionToken(identity.user.uuid);

            // store identity in a session
            var sess = serverContext.sessions.create(sessionId, sessionValidity);

            sess.jar.Register <RemoteAuthentication>(identity);

            return(sessionId);
        }
        RemoteStop(ChargingSession_Id SessionId,
                   ReservationHandling?ReservationHandling   = null,
                   eMobilityProvider_Id?ProviderId           = null,
                   RemoteAuthentication RemoteAuthentication = null,

                   DateTime?Timestamp = null,
                   CancellationToken?CancellationToken = null,
                   EventTracking_Id EventTrackingId    = null,
                   TimeSpan?RequestTimeout             = null)

        {
            return(Task.FromResult(RemoteStopResult.OutOfService(SessionId)));
        }
        RemoteStart(ChargingLocation ChargingLocation,
                    ChargingProduct ChargingProduct           = null,
                    ChargingReservation_Id?ReservationId      = null,
                    ChargingSession_Id?SessionId              = null,
                    eMobilityProvider_Id?ProviderId           = null,
                    RemoteAuthentication RemoteAuthentication = null,

                    DateTime?Timestamp = null,
                    CancellationToken?CancellationToken = null,
                    EventTracking_Id EventTrackingId    = null,
                    TimeSpan?RequestTimeout             = null)
        {
            return(Task.FromResult(RemoteStartResult.OutOfService));
        }
Exemple #12
0
        public void PwdAuthTest()
        {
            try
            {
                if (!TestUser.Create())
                {
                    Assert.Inconclusive("Please rerun the test as administrator.");
                }
                var goodCred = new RemoteAuthentication(AuthenticationTypes.Password, TestUser.Username, TestUser.Password);
                var badCred  = new RemoteAuthentication(AuthenticationTypes.Password, "foo", "bar");
                using (new RemotePcapServer(PwdAuthArgs))
                {
                    var pcapIfs  = PcapInterface.GetAllPcapInterfaces("rpcap://localhost/", goodCred);
                    var loopback = new IPEndPoint(IPAddress.Loopback, 2002);

                    // using rpcap with LibPcapLiveDevice should be possible
                    using var device = new LibPcapLiveDevice(pcapIfs[0]);

                    // repassing the auth to Open() should be optional
                    device.Open();
                    Assert.IsTrue(device.Opened);
                    device.Close();

                    Assert.Throws <PcapException>(
                        () => device.Open(StrictConfig(new DeviceConfiguration
                    {
                        Mode = DeviceModes.NoCaptureRemote,
                        // Setting Immediate increase code coverage
                        // Does not affect overall function of the test
                        // Immediate would be translated to DeviceModes.MaxResponsiveness
                        Immediate   = true,
                        ReadTimeout = 1,
                        Credentials = badCred
                    })),
                        "Credentials provided to Open() method takes precedence"
                        );

                    Assert.Throws <PcapException>(
                        () => PcapInterface.GetAllPcapInterfaces("rpcap://localhost/", badCred)
                        );
                }
            }
            finally
            {
                TestUser.Delete();
            }
        }
        public static RemoteAuthentication ToWWCP(this User_Id UserId)
        {
            if (UserId.Format == UserIdFormats.eMA ||
                UserId.Format == UserIdFormats.eMI3 ||
                UserId.Format == UserIdFormats.EVCO ||
                UserId.Format == UserIdFormats.EMP_SPEC)
            {
                return(RemoteAuthentication.FromRemoteIdentification(eMobilityAccount_Id.Parse(UserId.ToString())));
            }

            if (UserId.Format == UserIdFormats.RFID_UID)
            {
                return(RemoteAuthentication.FromAuthToken(Auth_Token.Parse(UserId.ToString())));
            }

            return(null);
        }
Exemple #14
0
        public void PwdAuthTest()
        {
            try
            {
                if (!TestUser.Create())
                {
                    Assert.Inconclusive("Please rerun the test as administrator.");
                }
                var goodCred = new RemoteAuthentication(AuthenticationTypes.Password, TestUser.Username, TestUser.Password);
                var badCred  = new RemoteAuthentication(AuthenticationTypes.Password, "foo", "bar");
                using (new RemotePcapServer(PwdAuthArgs))
                {
                    var pcapIfs      = PcapInterface.GetAllPcapInterfaces("rpcap://localhost/", goodCred);
                    var npcapDevices = NpcapDeviceList.Devices(IPAddress.Loopback, NpcapDeviceList.RpcapdDefaultPort, goodCred);
                    CollectionAssert.IsNotEmpty(npcapDevices);

                    var devices = new PcapDevice[] {
                        // using NpcapDevice
                        npcapDevices[0],
                        // using rpcap with LibPcapLiveDevice should be possible
                        new LibPcapLiveDevice(pcapIfs[0])
                    };
                    foreach (var device in devices)
                    {
                        // repassing the auth to Open() should be optional
                        device.Open();
                        Assert.IsTrue(device.Opened);
                        device.Close();
                    }

                    Assert.Throws <PcapException>(
                        () => npcapDevices[0].Open(OpenFlags.NoCaptureRemote, 1, badCred),
                        "Credentials provided to Open() method takes precedence"
                        );

                    Assert.Throws <PcapException>(
                        () => PcapInterface.GetAllPcapInterfaces("rpcap://localhost/", badCred)
                        );
                }
            }
            finally
            {
                TestUser.Delete();
            }
        }
        Reserve(ChargingLocation ChargingLocation,
                ChargingReservationLevel ReservationLevel = ChargingReservationLevel.EVSE,
                DateTime?StartTime = null,
                TimeSpan?Duration  = null,
                ChargingReservation_Id?ReservationId      = null,
                eMobilityProvider_Id?ProviderId           = null,
                RemoteAuthentication RemoteAuthentication = null,
                ChargingProduct ChargingProduct           = null,
                IEnumerable <Auth_Token> AuthTokens       = null,
                IEnumerable <eMobilityAccount_Id> eMAIds  = null,
                IEnumerable <UInt32> PINs = null,

                DateTime?Timestamp = null,
                CancellationToken?CancellationToken = null,
                EventTracking_Id EventTrackingId    = null,
                TimeSpan?RequestTimeout             = null)

        {
            return(Task.FromResult(ReservationResult.OutOfService));
        }
Exemple #16
0
        Reserve(ChargingLocation ChargingLocation,
                ChargingReservationLevel ReservationLevel = ChargingReservationLevel.EVSE,
                DateTime?StartTime = null,
                TimeSpan?Duration  = null,
                ChargingReservation_Id?ReservationId      = null,
                eMobilityProvider_Id?ProviderId           = null,
                RemoteAuthentication RemoteAuthentication = null,
                ChargingProduct ChargingProduct           = null,
                IEnumerable <Auth_Token> AuthTokens       = null,
                IEnumerable <eMobilityAccount_Id> eMAIds  = null,
                IEnumerable <UInt32> PINs = null,

                DateTime?Timestamp = null,
                CancellationToken?CancellationToken = null,
                EventTracking_Id EventTrackingId    = null,
                TimeSpan?RequestTimeout             = null)

        {
            if (_ANetworkChargingStation == null)
            {
                return(ReservationResult.OutOfService);
            }

            return(await _ANetworkChargingStation.
                   Reserve(ChargingLocation,
                           ReservationLevel,
                           StartTime,
                           Duration,
                           ReservationId,
                           ProviderId,
                           RemoteAuthentication,
                           ChargingProduct,
                           AuthTokens,
                           eMAIds,
                           PINs,

                           Timestamp,
                           CancellationToken,
                           EventTrackingId,
                           RequestTimeout));
        }
Exemple #17
0
        RemoteStart(ChargingProduct ChargingProduct           = null,
                    ChargingReservation_Id?ReservationId      = null,
                    ChargingSession_Id?SessionId              = null,
                    eMobilityProvider_Id?ProviderId           = null,
                    RemoteAuthentication RemoteAuthentication = null,

                    DateTime?Timestamp = null,
                    CancellationToken?CancellationToken = null,
                    EventTracking_Id EventTrackingId    = null,
                    TimeSpan?RequestTimeout             = null)


        => RemoteStart(ChargingLocation.FromEVSEId(Id),
                       ChargingProduct,
                       ReservationId,
                       SessionId,
                       ProviderId,
                       RemoteAuthentication,

                       Timestamp,
                       CancellationToken,
                       EventTrackingId,
                       RequestTimeout);
Exemple #18
0
 public Task <ReservationResult> Reserve(ChargingLocation ChargingLocation, ChargingReservationLevel ReservationLevel = ChargingReservationLevel.EVSE, DateTime?StartTime = null, TimeSpan?Duration = null, ChargingReservation_Id?ReservationId = null, eMobilityProvider_Id?ProviderId = null, RemoteAuthentication RemoteAuthentication = null, ChargingProduct ChargingProduct = null, IEnumerable <Auth_Token> AuthTokens = null, IEnumerable <eMobilityAccount_Id> eMAIds = null, IEnumerable <uint> PINs = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }
Exemple #19
0
 internal ResponseModel Delete(RemoteAuthentication remoteAuthentication)
 {
     return(_remoteAuthenticationRepository.Delete(remoteAuthentication));
 }
Exemple #20
0
 internal ResponseModel Insert(RemoteAuthentication remoteAuthentication)
 {
     return(_remoteAuthenticationRepository.Insert(remoteAuthentication));
 }
Exemple #21
0
 public Task <RemoteStopResult> RemoteStop(ChargingSession_Id SessionId, ReservationHandling?ReservationHandling = null, eMobilityProvider_Id?ProviderId = null, RemoteAuthentication RemoteAuthentication = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }
Exemple #22
0
 public virtual void updateRecord(RemoteAuthentication remoteAuth)
 {
 }
Exemple #23
0
 public GateUser(RemoteAuthentication auth, string session)
 {
     this.auth    = auth;
     this.session = session;
 }