Esempio n. 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;
            }
        }
Esempio n. 2
0
 private IAuthRepository CreateNewAuthRepository()
 {
     IAuthRepository authRepository;
     if (authenticationInformation != null)
         authRepository = CreateAuthRepositoryWithProvidedAuthenticationInformation();
     else
         authRepository = new AuthRepository(elementProxy);
     return authRepository;
 }
Esempio n. 3
0
 public PhotoRepository(IFlickrElement elementProxy, AuthInfo authenticationInformation)
     : base(elementProxy, authenticationInformation, typeof(IPhotoRepository))
 {
     this.elementProxy = elementProxy;
     authRepo          = new AuthRepository(elementProxy, authenticationInformation);
 }
Esempio n. 4
0
 public PhotoRepository(IFlickrElement elementProxy) : base(elementProxy, typeof(IPhotoRepository))
 {
     this.elementProxy = elementProxy;
     authRepo          = new AuthRepository(elementProxy);
 }