示例#1
0
        /// <summary>
        /// Set the bearer token onto a set of credentials
        /// </summary>
        /// <param name="credentials">Credentials to update</param>
        /// <param name="force">Set the bearer token even if it is not required for executing queries</param>
        public static void InitializeApplicationOnlyCredentials(ITwitterCredentials credentials = null, bool force = false)
        {
            credentials = credentials ?? CredentialsAccessor.CurrentThreadCredentials;

            if (credentials == null)
            {
                throw new TwitterNullCredentialsException("Initialize Application Bearer needs to either have a" +
                                                          " credentials parameter or have the thread credentials set up.");
            }

            var isBearerAlreadySet = !string.IsNullOrEmpty(credentials.ApplicationOnlyBearerToken);
            var isBearerRequired   = string.IsNullOrEmpty(credentials.AccessToken) || string.IsNullOrEmpty(credentials.AccessTokenSecret);

            if (force || (isBearerRequired && !isBearerAlreadySet))
            {
                AuthFactory.InitializeApplicationBearer(credentials);
            }
        }
示例#2
0
        public override void Load()
        {
            var factory = new AdoNetFactory();
            var type    = factory.GetType();

            Bind <IUnitOfWork>().To <ADOUnitOfWork>().WithConstructorArgument(type, factory);
            Bind <ITurmaRepository>().To <TurmaRepositorySql>().WithConstructorArgument(type, factory);
            Bind <IAulaRepository>().To <AulaRepositorySql>().WithConstructorArgument(type, factory);
            Bind <IAlunoRepository>().To <AlunoRepositorySql>().WithConstructorArgument(type, factory);

            var authFactory = new AuthFactory();
            var typeAuth    = authFactory.GetType();

            Bind <IAuthUnitOfWork>().To <AuthUnitOfWork>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IUserStore <User> >().To <IdentityUserStore>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IAccountRepository>().To <AccountRepository>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IGroupRepository>().To <GroupRepository>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IPermissionRepository>().To <PermissionRepository>().WithConstructorArgument(typeAuth, authFactory);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ConfigHelper  = new ConfigHelper();
        m_WebLogService = new WebLogService();
        m_PostFactory   = new PostFactory();
        m_MemberFactory = new MemberFactory();
        m_AuthFactory   = new AuthFactory();
        m_HttpHelper    = new HttpHelper();
        m_SessionHelper = new SessionHelper();
        m_AuthService   = m_AuthFactory.GetAuthService();
        m_MemberService = m_MemberFactory.GetMemberService();
        m_PostService   = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            pnlContent.Visible = false;
            fillGridView();
            ShowMode();
            InitDDL();
        }
    }
示例#4
0
        public override void Load()
        {
            var entityFrameworkFactory = new EntityFrameworkFactory();
            var type = entityFrameworkFactory.GetType();

            Bind <IUnitOfWork>().To <EntityFrameworkUnitOfWork>().WithConstructorArgument(type, entityFrameworkFactory);
            Bind <ITurmaRepository>().To <TurmaRepositoryEF>().WithConstructorArgument(type, entityFrameworkFactory);
            Bind <IAulaRepository>().To <AulaRepositoryEF>().WithConstructorArgument(type, entityFrameworkFactory);
            Bind <IAlunoRepository>().To <AlunoRepositoryEF>().WithConstructorArgument(type, entityFrameworkFactory);

            var authFactory = new AuthFactory();
            var typeAuth    = authFactory.GetType();


            Bind <IAuthUnitOfWork>().To <AuthUnitOfWork>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IUserStore <User> >().To <UserStore <User> >();//.WithConstructorArgument(typeAuth, authFactory);
            Bind <IAccountRepository>().To <AccountRepository>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IGroupRepository>().To <GroupRepository>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IPermissionRepository>().To <PermissionRepository>().WithConstructorArgument(typeAuth, authFactory);
            Bind <IClaimRepository>().To <ClaimRepository>().WithConstructorArgument(typeAuth, authFactory);
        }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ConfigHelper    = new ConfigHelper();
        m_WebLogService   = new WebLogService();
        m_PostFactory     = new PostFactory();
        m_AuthFactory     = new AuthFactory();
        m_CommonFactory   = new CommonFactory();
        m_SessionHelper   = new SessionHelper();
        m_WebUtility      = new WebUtility();
        m_AuthService     = m_AuthFactory.GetAuthService();
        m_PostFileService = m_PostFactory.GetPostFileService();
        m_CommonService   = m_CommonFactory.GetCommonService();
        m_PostService     = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            pnlContent.Visible = false;
            fillGridView();
            ShowMode();
        }
    }
    /// <summary>
    /// 檢查權限
    /// </summary>
    /// <param name="application"></param>
    /// <param name="uri"></param>
    /// <param name="rawUrl"></param>
    private void CheckAuth(HttpApplication application, Uri uri, string rawUrl)
    {
        SessionHelper sHelper = new SessionHelper();

        LoginUserVO loginUser = sHelper.LoginUser;

        string applicationPath = application.Request.ApplicationPath;

        string mamagePath = String.IsNullOrEmpty(applicationPath) ? "/admin" : applicationPath + "/admin";

        mamagePath = mamagePath.Replace("//", "/");

        if (rawUrl.StartsWith(mamagePath) == true)
        {
            AuthFactory  authFactory = new AuthFactory();
            IAuthService authService = authFactory.GetAuthService();

            if (loginUser == null)
            {
                toLoginPage(application.Response);
                return;
            }

            string userId = loginUser.UserId;

            //判斷只有主路徑是否有權限
            //if (!PathHasRight(UserMenuFuncContainer.GetInstance().GetUser(userId), uri, UserMenuFuncContainer.GetInstance().PathFunc))
            //{
            //    toLoginNoAuthPage(application.Response);
            //}


            //判斷所有路徑是否有權限
            if (!authService.PathHasAuth(UserMenuFuncContainer.GetInstance().GetUser(userId), uri))
            {
                toLoginNoAuthPage(application.Response);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        m_WebLogService     = new WebLogService();
        m_PostFactory       = new PostFactory();
        m_MemberFactory     = new MemberFactory();
        m_AuthFactory       = new AuthFactory();
        m_HttpHelper        = new HttpHelper();
        m_SessionHelper     = new SessionHelper();
        m_AccountingFactory = new AccountingFactory();
        m_AuthService       = m_AuthFactory.GetAuthService();
        m_MemberService     = m_MemberFactory.GetMemberService();
        m_PostService       = m_PostFactory.GetPostService();
        m_AccountingService = m_AccountingFactory.GetAccountingService();

        if (!IsPostBack)
        {
            ////先更新到今天之前的結帳
            m_AccountingService.UpdateCash();
            txtDate.Text = ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow).ToString("yyyy/MM/dd");

            ShowMode();
            LoadDataToUI();
        }
    }
示例#8
0
 private void _loginBtn_Click(object sender, EventArgs e)
 {
     AuthFactory.getAuth(AuthType.OAuth).authorize(this);
 }
示例#9
0
文件: Auth.cs 项目: tpatel6/tweetinvi
 /// <summary>
 /// Invalidate application only credentials so that they can no longer be used to access Twitter.
 /// </summary>
 public static bool InvalidateCredentials(ITwitterCredentials credentials = null)
 {
     return(AuthFactory.InvalidateCredentials(credentials ?? CredentialsAccessor.CurrentThreadCredentials));
 }
示例#10
0
 public AccountRepository(AuthFactory dbFactory)
     : base(dbFactory)
 {
 }
示例#11
0
 public GroupRepository(AuthFactory dbFactory)
     : base(dbFactory)
 {
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_WebLogService = new WebLogService();
     m_AuthFactory   = new AuthFactory();
     m_AuthService   = m_AuthFactory.GetAuthService();
 }
示例#13
0
 public ClaimRepository(AuthFactory dbFactory)
     : base(dbFactory)
 {
 }
示例#14
0
 public PermissionRepository(AuthFactory dbFactory)
     : base(dbFactory)
 {
 }
示例#15
0
        protected override async Task OnInitAsync()
        {
            await(await AuthFactory.CreateAsync()).SignedIn();

            UriHelper.NavigateTo("/");
        }
        /// <summary>
        /// 載入user的資料
        /// </summary>
        /// <param name="userId"></param>
        private void loadUser(string userId)
        {
            m_UserDic = m_UserMenuFunc.m_UserDic;

            AuthFactory authFactory = new AuthFactory();
            IAuthService authService = authFactory.GetAuthService();

            LoginUserVO user = authService.GetLoginUserByIdNoLazy(userId);

            m_Log.Debug("lock UserMenuFuncContainer loadUser");
            lock (typeof(UserMenuFuncContainer))
            {
                m_UserDic.Remove(userId);
                m_UserDic.Add(userId, user);
            }
        }
        private static void initAllRole()
        {
            AuthFactory authFactory = new AuthFactory();
            IAuthService authService = authFactory.GetAuthService();

            IList<LoginRoleVO> roleList = authService.GetAllLoginRoleListNoLazy();
            m_UserMenuFunc.RoleDic = new Dictionary<int, LoginRoleVO>();

            foreach (LoginRoleVO role in roleList)
            {
                m_UserMenuFunc.RoleDic.Add(role.RoleId, role);
            }
        }
        private static void initAllMenu()
        {
            AuthFactory authFactory = new AuthFactory();
            IAuthService authService = authFactory.GetAuthService();

            IList<MenuFuncVO> iList = authService.GetTopMenuFuncNoLazy();

            m_UserMenuFunc.AllMenu = iList;
        }
示例#19
0
        public DatabaseAuthFixture()
        {
            Factory = new AuthFactory();

            UnitOfWork = new AuthUnitOfWork(Factory);
        }
 public TreeveiwService()
 {
     m_AuthFactory = new AuthFactory();
     m_AuthService = m_AuthFactory.GetAuthService();
 }