Exemple #1
0
        private async void WebBrowser_Navigating(object sender, NavigatingCancelEventArgs e)
        {
            var uri = e.Uri;

            if (uri.ToString().StartsWith(OidcClient.Options.RedirectUri))
            {
                var code  = OidcClient.GetCode(uri.Query);
                var token = await _oidcClient.GetTokenAsync(code);

                TokenFile.Write(token);
                this.Close();
            }
        }
        private async Task <TokenModel> GetTokenModel()
        {
            var token = await TokenFile.ReadAsync();

            if (token == null)
            {
                return(new TokenModel());
            }

            return(new TokenModel
            {
                Token = token.ToString(Formatting.Indented),
                IdToken = JwtModel.From(token.Value <string>("id_token")),
                AccessToken = JwtModel.From(token.Value <string>("access_token")),
            });
        }
Exemple #3
0
        public void TestTopicFile()
        {
            try
            {
                //initialize catalog explorer witho our optimized connection string
                const string connStr         = "Data Source=(local);Initial Catalog=BizTalkMgmtDb;Integrated Security=True;Min Pool Size=10;MultipleActiveResultSets=True;Connect Timeout=30;Network Library=dbnmpntw;Application Name=ShoBiz";
                const string appName         = "EPS Cloud Catalog";
                const string baseDirectory   = @"C:\Temp\";
                const string imagesDirectory = @"C:\Temp\images\";
                const string contentFile     = @"C:\Temp\ContentFile.content";
                const string projectFile     = baseDirectory + "ShoBizProject.shfbproj";
                const string tokenFile       = baseDirectory + "ShoBizTokens.tokens";
                const string rulesDb         = "BizTalkRuleEngineDb";
                //CatalogExplorerFactory.CatalogExplorer(connStr, true);

                //what apps do we want to document?
                List <string> apps = new List <string>();
                apps.Add(appName);

                AppsTopic appsTopic = new AppsTopic(baseDirectory, imagesDirectory, apps, rulesDb);

                do
                {
                    Thread.Sleep(250);
                } while (!appsTopic.ReadyToSave);

                //save applications topic (and all children)
                appsTopic.Save();

                //save content file and add to the project
                ContentFile.GetContentFile().AddApplicationTopic(appsTopic.GetContentLayout());
                ContentFile.GetContentFile().Save(contentFile);
                ProjectFile.GetProjectFile().AddContentLayoutFile(contentFile);

                //save token file and add to the project
                TokenFile.GetTokenFile().Save(tokenFile);
                ProjectFile.GetProjectFile().AddTokenFile(tokenFile);

                //save the project file
                ProjectFile.GetProjectFile().Save(projectFile);
            }
            catch (Exception e)
            {
                Trace.WriteLine(string.Format("{0}: {1} : {2}", e.GetType(), e.Message, e.StackTrace));
            }
        }
Exemple #4
0
        private async void NameLoginWebView_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
        {
            var uri = args.Uri;

            if (uri.ToString().StartsWith(OidcClient.Options.RedirectUri))
            {
                var code  = OidcClient.GetCode(uri.Query);
                var token = await this._oidcClient.GetTokenAsync(code);

                await TokenFile.WriteAsync(token);

                if (this.Frame.CanGoBack)
                {
                    this.Frame.GoBack();
                }
            }
        }
Exemple #5
0
        public async static Task Save(string token)
        {
            var tokenModel = new TokenFile()
            {
                Token = token
            };

            StorageFile fileToken = null;


            try
            {
                fileToken = await StaticContent.LocalFolder.GetFileAsync("token.json");
            }catch
            {
                fileToken = await StaticContent.LocalFolder.CreateFileAsync("token.json");
            }

            var json = JsonConvert.SerializeObject(tokenModel);

            await FileIO.WriteTextAsync(fileToken, json);
        }
        private async void Logout_Click(object sender, RoutedEventArgs e)
        {
            await TokenFile.DeleteAsync();

            await RefreshUi();
        }
Exemple #7
0
 private void Logout_Click(object sender, RoutedEventArgs e)
 {
     TokenFile.Delete();
     RefreshUi();
 }