示例#1
0
        // Create a protection engine
        private IProtectionEngine CreateProtectionEngine(Identity identity)
        {
            if (profile == null)
            {
                profile = CreateProtectionProfile(appInfo, ref authDelegate);
            }

            // Create protection engine settings object. Passing in empty string for the first parameter, engine ID, will cause the SDK to generate a GUID.
            // Passing in a email address or other unique value helps to ensure that the cached engine is loaded each time for the same user.
            // Locale settings are supported and should be provided based on the machine locale, particular for client applications.
            var engineSettings = new ProtectionEngineSettings(identity.Email, authDelegate, "", "")
            {
                Identity = identity
            };

            var engine = profile.AddEngine(engineSettings);

            return(engine);
        }
示例#2
0
        public Action(ApplicationInfo appInfo)
        {
            this.appInfo = appInfo;

            // Initialize AuthDelegateImplementation using AppInfo.
            authDelegate = new AuthDelegateImplementation(this.appInfo);

            // Initialize SDK DLLs. If DLLs are missing or wrong type, this will throw an exception
            MIP.Initialize(MipComponent.Protection);

            // This method in AuthDelegateImplementation triggers auth against Graph so that we can get the user ID.
            var id = authDelegate.GetUserIdentity();

            // Create profile
            profile = CreateProtectionProfile(appInfo, ref authDelegate);

            // Create engine by providing Idenity from authDelegate to assist with service discovery.
            engine = CreateProtectionEngine(id);
        }