/// <summary> /// Checks the authentication cookie and extract/returns the user name. If user is not authenticated it throws the appropriate exception /// </summary> /// <param name="authenticationService"></param> /// <param name="authenticationCookie"></param> /// <param name="userName"></param> /// <param name="extraOptions"></param> internal static void Authenticate(IAuthenticationAddin authenticationService, string authenticationCookie, out string userName, ExtraOptions extraOptions) { AuthenticationInfo info = null; try { info = authenticationService.GetAuthenticationInfo(authenticationCookie, null); } catch (Exception ex) { throw new ServiceAuthenticationException(ex.Message); } userName = ""; if (null != info) { userName = info.UserName; if (authenticationService.IsTimedOut(info, null)) { throw new ServiceAuthenticationException("Timed-out"); } } else { throw new ServiceAuthenticationException("Not Authenticated"); } }
public bool IsTimedOut(AuthenticationInfo ai, string userData) { return(_addin.IsTimedOut(ai, userData)); }