internal static string Authenticate(string authenticationCookie, bool impersonater = false) { AuthenticationInfo ai = null; var srv = AddinsFactory.CreateSessionAuthenticationAddin(); try { ai = srv.GetAuthenticationInfo(authenticationCookie); } catch (Exception ex) { throw new ServiceAuthenticationException(ex.Message); } if (srv.IsTimedOut(ai)) { throw new ServiceAuthenticationException("Timed-out"); } if (impersonater && !string.IsNullOrEmpty(ai.ImpersonatedUserName)) { return(ai.ImpersonatedUserName); } else { return(ai.UserName); } }
internal static string Authorize(string authenticationCookie, Permission permission) { AuthenticationInfo ai = null; var srv = AddinsFactory.CreateSessionAuthenticationAddin(); try { ai = srv.GetAuthenticationInfo(authenticationCookie); } catch (Exception ex) { throw new ServiceAuthenticationException(ex.Message); } if (srv.IsTimedOut(ai)) { throw new ServiceAuthenticationException("Timed-out"); } if (!srv.HasPermission(ai, permission)) { throw new ServiceAuthenticationException("Not Authenticated"); } //passed return(ai.UserName); }
internal static string Authenticate(string authenticationCookie) { AuthenticationInfo ai = null; var srv = AddinsFactory.CreateSessionAuthenticationAddin(); try { ai = srv.GetAuthenticationInfo(authenticationCookie); } catch (Exception ex) { throw new ServiceAuthenticationException(ex.Message); } if (srv.IsTimedOut(ai)) { throw new ServiceAuthenticationException("Timed-out"); } return(ai.UserName); }