Esempio n. 1
0
        public JsonResult DigestToken(string url)
        {

            CookieContainer cookieContainer = GetRequestCookie();

            SPOnlineLoginHelper SPLogin = new SPOnlineLoginHelper(new Uri(url));
            SPAccessTokens accessTokens = SPLogin.RefreshDigestToken(url, cookieContainer);
            return Json(accessTokens);
        }
Esempio n. 2
0
        /// <summary>
                 /// Initialize the authentication object when user logged in.
                 /// </summary>
                 /// <param name="spSiteUrl">sharepoint site URL</param>
                 /// <param name="username">Microsoft account userr name</param>
                 /// <param name="password">Password for the account</param>
                 /// <param name="libraryname">Name of library created for videos in sharepoint site</param>
                 /// <returns></returns>
        public static async Task <bool> InitAuthObj(Uri spSiteUrl, string username, string password, string libraryname)
        {
            var spauthobj     = new SPOnlineLoginHelper(spSiteUrl, username, password, libraryname);
            var authobjcookie = new SPOnlineLoginHelper(spSiteUrl, username, password);

            authobj = spauthobj;
            CookieContainer cc = await authobjcookie.GetCookieContainer();

            var cookies = from Cookie c in cc.GetCookies(spSiteUrl) where c.Name == "FedAuth" select c;

            if (cookies.Count() > 0)
            {
                return(true);
            }
            else
            {
                throw new Exception("Could not retrieve Auth cookies");
            }
        }
Esempio n. 3
0
 /// <summary>
         /// Initialize the authentication object when user logged in.
         /// </summary>
         /// <param name="spSiteUrl">sharepoint site URL</param>
         /// <param name="username">Microsoft account userr name</param>
         /// <param name="password">Password for the account</param>
         /// <param name="libraryname">Name of library created for videos in sharepoint site</param>
         /// <returns></returns>
 public static async Task<bool> InitAuthObj(Uri spSiteUrl, string username, string password, string libraryname)
 {
     var spauthobj = new SPOnlineLoginHelper(spSiteUrl, username, password, libraryname);
     var authobjcookie = new SPOnlineLoginHelper(spSiteUrl, username, password);
     authobj = spauthobj;
     CookieContainer cc = await authobjcookie.GetCookieContainer();
     var cookies = from Cookie c in cc.GetCookies(spSiteUrl) where c.Name == "FedAuth" select c;
     if (cookies.Count() > 0)
     {
         return true;
     }
     else
         throw new Exception("Could not retrieve Auth cookies");
 }
Esempio n. 4
0
 public async Task<JsonResult> Auth(string username, string password, string url)
 {
     SPOnlineLoginHelper SPLogin = new SPOnlineLoginHelper(new Uri(url), username, password);
     SPAccessTokens accessTokens = await SPLogin.GetAccessTokens();
     return Json(accessTokens);
 }