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