Пример #1
0
        public override bool SaveToken(string permission)
        {
            IAuthRepository authRepository = new AuthRepository(elementProxy);
            try
            {
                bool authenticate = false;

                string frob = CreateWebFrobIfNecessary(out authenticate);

                if (authenticate)
                {
                    /// initiate the authenticaiton process.
                    HttpContext.Current.Response.Redirect(GetAuthenticationUrl(permission));
                }

                AuthToken token = authRepository.GetTokenFromFrob(frob);

                if (token != null)
                {
                    OnAuthenticationComplete(token);
                }

                return true;
            }
            catch(Exception ex)
            {
               /// failed
               System.Diagnostics.Debug.WriteLine(ex.Message);
               return false;
            }
        }
Пример #2
0
 private IAuthRepository CreateNewAuthRepository()
 {
     IAuthRepository authRepository;
     if (authenticationInformation != null)
         authRepository = CreateAuthRepositoryWithProvidedAuthenticationInformation();
     else
         authRepository = new AuthRepository(elementProxy);
     return authRepository;
 }
Пример #3
0
 public PhotoRepository(IFlickrElement elementProxy, AuthInfo authenticationInformation)
     : base(elementProxy, authenticationInformation, typeof(IPhotoRepository))
 {
     this.elementProxy = elementProxy;
     authRepo          = new AuthRepository(elementProxy, authenticationInformation);
 }
Пример #4
0
 public PhotoRepository(IFlickrElement elementProxy) : base(elementProxy, typeof(IPhotoRepository))
 {
     this.elementProxy = elementProxy;
     authRepo          = new AuthRepository(elementProxy);
 }