private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "shared")
        {
            if (leap)
            {
                if (!leapGrabScript)
                {
                    loadScript();
                }

                if (leapGrabScript)
                {
                    AuthorityManager am = other.gameObject.GetComponent <AuthorityManager>();
                    leapGrabScript.touchRightDetected(am);
                }
            }
            else if (vive)
            {
                if (!viveGrabScript)
                {
                    loadScript();
                }
                if (viveGrabScript)
                {
                    AuthorityManager am = other.gameObject.GetComponent <AuthorityManager>();
                    viveGrabScript.setAuthorityManagerRightHand(am);
                    viveGrabScript.setRightHandTouching(true);
                }
            }
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (actor == null)
        {
            actor = gameObject.GetComponentInChildren <Actor>(); //therefore the script must be added to VIVE-Scene object
            if (actor != null)
            {
                actor.viveStatus = true;
            }
        }

        leftTriggerDown  = getPinchLeft();
        rightTriggerDown = getPinchRight();

        if (leftHandTouching || rightHandTouching)
        {
            // notify AuthorityManager that grab conditions are fulfilled
            if (actor.lastCollider != null)
            {
                //  print("lastcollider is: " + actor.lastCollider);
                am = actor.lastCollider.GetComponent <AuthorityManager>();
                am.grabbedByPlayer = true;
            }
            // Debug.Log("SUCCESS");
        }
        else
        {
            // grab conditions are not fulfilled
            if (am != null)
            {
                am.grabbedByPlayer = false;
            }
        }
    }
示例#3
0
 public AuthorityController(ILogger <AuthorityController> logger, IServiceProvider serviceProvider,
                            AuthorityService authorityService,
                            AuthorityManager authenticator) : base(logger, serviceProvider)
 {
     _authorityService = authorityService;
     _authenticator    = authenticator;
 }
示例#4
0
 public static void ResetInternalStaticCaches()
 {
     // This initializes the classes so that the statics inside them are fully initialized, and clears any cached content in them.
     new InstanceDiscoveryManager(
         Substitute.For <IHttpManager>(),
         true, null, null);
     AuthorityManager.ClearValidationCache();
     SingletonThrottlingManager.GetInstance().ResetCache();
 }
示例#5
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
示例#6
0
 static public void removeAuthority(NetworkInstanceId netInstanceId)
 {
     if (m_manager == null)
     {
         m_manager = playerObject.GetComponent <AuthorityManager> ();
     }
     if (m_manager != null)
     {
         m_manager.CmdRemoveObjectAuthority(netInstanceId);
     }
 }
示例#7
0
    void CmdRemoveObjectAuthorityFromClientForSharedObjects(NetworkIdentity netID) //, Vector3 forcevector, float throwingSpeedFactor, NetworkInstanceId netInsID)
    {
        //Debug.Log("in CmdRemoveObjectAuthorityFromClientForSharedObjects for shared object netInsid=" + netID);
        //netID.GetComponent<AuthorityManager>().RemoveClientAuthority(this.connectionToClient);

        AuthorityManager authorityManager = netID.GetComponent <AuthorityManager>();

        if (authorityManager != null)
        {
            //Debug.Log("...for shared objects");
            authorityManager.RemoveClientAuthority(this.connectionToClient); //, forcevector, throwingSpeedFactor, netInsID);
            return;
        }
    }
示例#8
0
 // Use this for initialization
 void Start()
 {
     if ((authorityManager = GetComponent <AuthorityManager>()) == null)
     {
         Debug.LogError("authorityManager is NULL in OnGrabbedBehaviour");
     }
     if ((rigidbody = GetComponent <Rigidbody>()) == null)
     {
         Debug.LogError("rigidbody is NULL in OnGrabbedBehaviour");
     }
     if ((netId = GetComponent <NetworkIdentity>()) == null)
     {
         Debug.LogError("netId is NULL in OnGrabbedBehaviour");
     }
 }
        internal ServiceBundle(
            ApplicationConfiguration config,
            bool shouldClearCaches = false)
        {
            Config = config;

            ApplicationLogger = new MsalLogger(
                Guid.Empty,
                config.ClientName,
                config.ClientVersion,
                config.LogLevel,
                config.EnablePiiLogging,
                config.IsDefaultPlatformLoggingEnabled,
                config.LoggingCallback);

            PlatformProxy = config.PlatformProxy ?? PlatformProxyFactory.CreatePlatformProxy(ApplicationLogger);
            HttpManager   = config.HttpManager ?? new HttpManager(
                config.HttpClientFactory ??
                PlatformProxy.CreateDefaultHttpClientFactory());

            HttpTelemetryManager = new HttpTelemetryManager();
            if (config.TelemetryConfig != null)
            {
                // This can return null if the device isn't sampled in.  There's no need for processing MATS events if we're not going to send them.
                Mats = TelemetryClient.CreateMats(config, PlatformProxy, config.TelemetryConfig);
                MatsTelemetryManager = Mats?.TelemetryManager ??
                                       new TelemetryManager(config, PlatformProxy, config.TelemetryCallback);
            }
            else
            {
                MatsTelemetryManager = new TelemetryManager(config, PlatformProxy, config.TelemetryCallback);
            }

            InstanceDiscoveryManager = new InstanceDiscoveryManager(
                HttpManager,
                shouldClearCaches,
                config.CustomInstanceDiscoveryMetadata,
                config.CustomInstanceDiscoveryMetadataUri);

            WsTrustWebRequestManager = new WsTrustWebRequestManager(HttpManager);
            ThrottlingManager        = SingletonThrottlingManager.GetInstance();
            DeviceAuthManager        = config.DeviceAuthManagerForTest ?? PlatformProxy.CreateDeviceAuthManager();

            if (shouldClearCaches)
            {
                AuthorityManager.ClearValidationCache();
            }
        }
示例#10
0
        public MainWindow(AccountManager inAccountManager, Log.Logger inLogger)
        {
            InitializeComponent();
            TestWave();
            accountManager = inAccountManager;
            logger         = inLogger;

            authorityManager = new AuthorityManager(accountManager);
            AuthorityManagerAddControl();
            authorityManager.LoadAuthorityData();

            authorityManager.GetPermission((AuthorityLevel)accountManager.LoginAccount.PowerLevel);


            MakeLogEvent += MainWindow_MakeLogEvent;
        }
        public async Task FailedValidationTestAsync()
        {
            using (var harness = CreateTestHarness())
            {
                // add mock response for instance validation
                harness.HttpManager.AddMockHandler(
                    new MockHttpMessageHandler
                {
                    ExpectedMethod      = HttpMethod.Get,
                    ExpectedUrl         = "https://login.microsoftonline.com/common/discovery/instance",
                    ExpectedQueryParams = new Dictionary <string, string>
                    {
                        { "api-version", "1.1" },
                        {
                            "authorization_endpoint",
                            "https%3A%2F%2Flogin.microsoft0nline.com%2Fmytenant.com%2Foauth2%2Fv2.0%2Fauthorize"
                        },
                    },
                    ResponseMessage = MockHelpers.CreateFailureMessage(
                        HttpStatusCode.BadRequest,
                        "{\"error\":\"invalid_instance\"," + "\"error_description\":\"AADSTS50049: " +
                        "Unknown or invalid instance. Trace " + "ID: b9d0894d-a9a4-4dba-b38e-8fb6a009bc00 " +
                        "Correlation ID: 34f7b4cf-4fa2-4f35-a59b" + "-54b6f91a9c94 Timestamp: 2016-08-23 " +
                        "20:45:49Z\",\"error_codes\":[50049]," + "\"timestamp\":\"2016-08-23 20:45:49Z\"," +
                        "\"trace_id\":\"b9d0894d-a9a4-4dba-b38e-8f" + "b6a009bc00\",\"correlation_id\":\"34f7b4cf-" +
                        "4fa2-4f35-a59b-54b6f91a9c94\"}")
                });

                Authority instance = Authority.CreateAuthority("https://login.microsoft0nline.com/mytenant.com", true);
                Assert.IsNotNull(instance);
                Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);

                TestCommon.CreateServiceBundleWithCustomHttpManager(harness.HttpManager, authority: instance.AuthorityInfo.CanonicalAuthority, validateAuthority: true);
                try
                {
                    AuthorityManager am = new AuthorityManager(new RequestContext(harness.ServiceBundle, Guid.NewGuid()), instance);
                    await am.RunInstanceDiscoveryAndValidationAsync().ConfigureAwait(false);

                    Assert.Fail("validation should have failed here");
                }
                catch (Exception exc)
                {
                    Assert.IsTrue(exc is MsalServiceException);
                    Assert.AreEqual(((MsalServiceException)exc).ErrorCode, "invalid_instance");
                }
            }
        }
示例#12
0
        protected void ImageButton1_Click(object sender, EventArgs e)
        {
            string username = txtName.Text.ToString().Trim();
            string password = txtPwd.Text.ToString().Trim();

            if (String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password))
            {
                msg.InnerHtml = "用户名或密码为空"; return;
            }
            UserEntryService userentry = new UserEntryService();
            UserLogOnModel   model     = new UserLogOnModel()
            {
                Email = username, Password = password, RememberMe = false
            };

            try
            {
                if (userentry.Logon(model) != null)
                {
                    try
                    {
                        AuthorityManager.PermissionCheck("ManageSystem");
                        Response.Redirect("index.html");
                    }
                    catch (AccessForbiddenException)
                    {//访问拒绝
                        msg.InnerHtml = "您不是系统管理员,无法进入系统管理!";
                    }
                    catch (ActionForbiddenException)
                    { //禁止操作
                        msg.InnerHtml = "您的操作被拒绝,你没有进入后台的权限!";
                    }
                }
                else
                {
                    msg.InnerHtml = "用户名或者密码错误";
                }
            }
            catch (LogonException k)
            {//管理员被禁用
                msg.InnerHtml = k.Message;
            }
        }
        public override void OnServerDisconnect(NetworkConnectionToClient conn)         // Called on the server when any client disconnects
        {
            DebugLog.DebugWrite("OnServerDisconnect", MessageType.Info);

            // local conn = we are host, so skip
            if (conn is not LocalConnectionToClient)
            {
                // revert authority from ship
                if (ShipTransformSync.LocalInstance != null)
                {
                    var identity = ShipTransformSync.LocalInstance.netIdentity;
                    if (identity != null && identity.connectionToClient == conn)
                    {
                        identity.SetAuthority(QSBPlayerManager.LocalPlayerId);
                    }
                }

                // stop dragging for the orbs this player was dragging
                foreach (var qsbOrb in QSBWorldSync.GetWorldObjects <QSBOrb>())
                {
                    if (qsbOrb.TransformSync == null)
                    {
                        DebugLog.ToConsole($"{qsbOrb} TransformSync == null??????????", MessageType.Warning);
                        continue;
                    }

                    var identity = qsbOrb.TransformSync.netIdentity;
                    if (identity.connectionToClient == conn)
                    {
                        qsbOrb.SetDragging(false);
                        qsbOrb.SendMessage(new OrbDragMessage(false));
                    }
                }

                AuthorityManager.OnDisconnect(conn);
            }

            base.OnServerDisconnect(conn);
        }
示例#14
0
        internal ServiceBundle(
            ApplicationConfiguration config,
            bool shouldClearCaches = false)
        {
            Config = config;

            ApplicationLogger = new MsalLogger(
                Guid.Empty,
                config.ClientName,
                config.ClientVersion,
                config.LogLevel,
                config.EnablePiiLogging,
                config.IsDefaultPlatformLoggingEnabled,
                config.LoggingCallback);

            PlatformProxy = config.PlatformProxy ?? PlatformProxyFactory.CreatePlatformProxy(ApplicationLogger);
            HttpManager   = config.HttpManager ?? new HttpManager(
                config.HttpClientFactory ??
                PlatformProxy.CreateDefaultHttpClientFactory());

            HttpTelemetryManager = new HttpTelemetryManager();

            InstanceDiscoveryManager = new InstanceDiscoveryManager(
                HttpManager,
                shouldClearCaches,
                config.CustomInstanceDiscoveryMetadata,
                config.CustomInstanceDiscoveryMetadataUri);

            WsTrustWebRequestManager = new WsTrustWebRequestManager(HttpManager);
            ThrottlingManager        = SingletonThrottlingManager.GetInstance();
            DeviceAuthManager        = config.DeviceAuthManagerForTest ?? PlatformProxy.CreateDeviceAuthManager();

            if (shouldClearCaches) // for test
            {
                AuthorityManager.ClearValidationCache();
                PoPProviderFactory.Reset();
            }
        }
示例#15
0
    // Update is called once per frame
    void Update()
    {
        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }

        if (actor == null)
        {
            actor = gameObject.GetComponentInChildren <Actor>();
            if (actor != null)
            {
                actor.leapStatus = true;
            }
        }

        if (leftHandTouching || rightHandTouching)// && leftPinch && rightPinch)
        {
            // notify AuthorityManager that grab conditions are fulfilled
            //print("LEAP IS GRABABLE");

            if (actor != null && actor.lastCollider != null)
            {
                // print("lastcollider is: " + actor.lastCollider);
                am = actor.lastCollider.GetComponent <AuthorityManager>();
                am.grabbedByPlayer = true;
            }
        }
        else
        {
            // grab conditions are not fulfilled
            if (am != null)
            {
                am.grabbedByPlayer = false;
            }
        }
    }
        public AuthenticationRequestParameters(
            IServiceBundle serviceBundle,
            ITokenCacheInternal tokenCache,
            AcquireTokenCommonParameters commonParameters,
            RequestContext requestContext,
            Authority initialAuthority,
            string homeAccountId = null)
        {
            _serviceBundle    = serviceBundle;
            _commonParameters = commonParameters;
            RequestContext    = requestContext;

            CacheSessionManager = new CacheSessionManager(tokenCache, this);
            Scope            = ScopeHelper.CreateScopeSet(commonParameters.Scopes);
            RedirectUri      = new Uri(serviceBundle.Config.RedirectUri);
            AuthorityManager = new AuthorityManager(RequestContext, initialAuthority);

            // Set application wide query parameters.
            ExtraQueryParameters = serviceBundle.Config.ExtraQueryParameters ??
                                   new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            // Copy in call-specific query parameters.
            if (commonParameters.ExtraQueryParameters != null)
            {
                foreach (KeyValuePair <string, string> kvp in commonParameters.ExtraQueryParameters)
                {
                    ExtraQueryParameters[kvp.Key] = kvp.Value;
                }
            }

            ClaimsAndClientCapabilities = ClaimsHelper.GetMergedClaimsAndClientCapabilities(
                _commonParameters.Claims,
                _serviceBundle.Config.ClientCapabilities);

            HomeAccountId = homeAccountId;
        }
示例#17
0
    void CmdAssignObjectAuthorityToClient(NetworkIdentity netID)
    {
        //Debug.Log("in CmdAssignObjectAuthorityToClient for shared object netid=" + netID);

        AuthorityManager           authorityManager           = netID.GetComponent <AuthorityManager>();
        ParametersAuthorityManager parametersAuthorityManager = netID.GetComponent <ParametersAuthorityManager>();
        ViveParamsAuthorityManager viveParamsAuthorityManager = netID.GetComponent <ViveParamsAuthorityManager>();

        if (authorityManager != null)
        {
            //Debug.Log("...for shared objects");
            authorityManager.AssignClientAuthority(this.connectionToClient);
        }
        else if (parametersAuthorityManager != null)
        {
            //Debug.Log("...for parametersAuthorityManager");
            parametersAuthorityManager.AssignClientAuthority(this.connectionToClient);
        }
        else if (viveParamsAuthorityManager != null)
        {
            //Debug.Log("...for viveParamsAuthorityManager");
            viveParamsAuthorityManager.AssignClientAuthority(this.connectionToClient);
        }
    }
示例#18
0
 public void setAuthorityManagerRightHand(AuthorityManager authorityManager)
 {
     amRightHand = authorityManager;
 }
示例#19
0
 public void setAuthorityManagerLeftHand(AuthorityManager authorityManager)
 {
     amLeftHand = authorityManager;
 }
示例#20
0
 public void touchRightDetected(AuthorityManager authorityManager)
 {
     amRightHand = authorityManager;
     //Debug.Log("Touch right!");
     rightHandTouching = true;
 }
示例#21
0
 public void touchLeftDetected(AuthorityManager authorityManager)
 {
     amLeftHand = authorityManager;
     //Debug.Log("Touch left!");
     leftHandTouching = true;
 }
示例#22
0
 public TreeViewControlEx(UserInfo userInfo)
 {
     authMgr = new AuthorityManager(userInfo);
     treeNodes = new DataTable();
 }
示例#23
0
 public TreeViewControlEx()
 {
     authMgr = new AuthorityManager();
     treeNodes = new DataTable();
 }