Пример #1
0
        private IProtectionProfile CreateProtectionProfile(ApplicationInfo appInfo, ref AuthDelegateImplementation authDelegate)
        {
            // Initialize MipContext
            mipContext = MIP.CreateMipContext(appInfo, "mip_data", LogLevel.Trace, null, null);

            // Initialize ProtectionProfileSettings
            var profileSettings = new ProtectionProfileSettings(mipContext,
                                                                CacheStorageType.OnDisk,
                                                                new ConsentDelegateImplementation());

            // Use MIP.LoadProtectionProfileAsync() providing settings to create IProtectionProfile
            // IProtectionProfile is the root of all SDK operations for a given application
            var profile = MIP.LoadProtectionProfile(profileSettings);

            return(profile);
        }
Пример #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);
        }