Revision 99882980 trunk/Pithos.Client.WPF/PithosAccount.cs
b/trunk/Pithos.Client.WPF/PithosAccount.cs | ||
---|---|---|
49 | 49 |
using Pithos.Interfaces; |
50 | 50 |
using Pithos.Network; |
51 | 51 |
using log4net; |
52 |
using System.Windows.Forms; |
|
53 |
using System.IO; |
|
54 |
using Newtonsoft.Json; |
|
55 |
using System.Collections.Generic; |
|
56 |
using System.Collections.Specialized; |
|
57 |
|
|
52 | 58 |
|
53 | 59 |
namespace Pithos.Client.WPF |
54 | 60 |
{ |
... | ... | |
96 | 102 |
//var logoutUrl = loginUrl.Replace("login", "im/logout"); |
97 | 103 |
//var logoutProcess=Process.Start(logoutUrl); |
98 | 104 |
//TaskEx.Delay(2000).Wait(); |
105 |
|
|
106 |
//<= 0.13 |
|
99 | 107 |
var uriBuilder = new UriBuilder(loginUrl) |
100 | 108 |
{ |
101 | 109 |
Query = String.Format("next={0}&force=", listenerUrl) |
... | ... | |
107 | 115 |
where server.LoginUri == loginUrl |
108 | 116 |
select new Uri(server.LogoutUri)).FirstOrDefault(); |
109 | 117 |
|
110 |
|
|
111 |
|
|
112 | 118 |
var browser = new LoginView(retrieveUri,logoutUrl,accountName); |
113 | 119 |
if (true == browser.ShowDialog()) |
114 | 120 |
{ |
... | ... | |
132 | 138 |
|
133 | 139 |
public static Uri GetLoginUri(Uri serverUri) |
134 | 140 |
{ |
141 |
//<=0.13 |
|
135 | 142 |
var loginUri = serverUri.Combine("/login"); |
143 |
//var loginUri = new Uri("https://astakos.synnefo.dev.grnet.gr/astakos/weblogin/login"); |
|
144 |
|
|
145 |
//>0.13 |
|
146 |
|
|
147 |
var tokenUri = serverUri.Combine("astakos/identity/v2.0/tokens"); |
|
148 |
|
|
149 |
// WebClient webClient = new WebClient(); |
|
150 |
// string catalogResult = webClient.UploadString(tokenUri, ""); |
|
151 |
// MessageBox.Show(tokenUri.ToString()); |
|
152 |
|
|
153 |
WebRequest webRequest = WebRequest.Create(tokenUri); |
|
154 |
webRequest.Method = "POST"; |
|
155 |
|
|
156 |
using (WebResponse response = webRequest.GetResponse()) |
|
157 |
{ |
|
158 |
|
|
159 |
using (Stream stream = response.GetResponseStream()) |
|
160 |
{ |
|
161 |
StreamReader read = new StreamReader(stream, true); |
|
162 |
String responseStr = read.ReadToEnd(); |
|
163 |
|
|
164 |
Dictionary<string, string> Services = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseStr); |
|
165 |
|
|
166 |
// var myService = JsonConvert.DeserializeObject<accessUris>(responseStr); |
|
167 |
// MessageBox.Show(myService.access.ToString()); |
|
168 |
} |
|
169 |
} |
|
136 | 170 |
return loginUri; |
137 | 171 |
} |
138 | 172 |
|
Also available in: Unified diff