public static void OAuth1SetAccessToken(this ISession session, OAuth1Token token, bool isAuthorized = false) { OAuth1RequestInterceptor interceptor = GetExistingInterceptor(session); interceptor.SetAccessToken(token); interceptor.IsAuthorized = isAuthorized; }
public static ISession OAuth1Logger(this ISession session, IOAuth1Logger logger) { OAuth1RequestInterceptor interceptor = GetExistingInterceptor(session); interceptor.Logger = logger; return(session); }
private static OAuth1RequestInterceptor GetExistingInterceptor(ISession session) { OAuth1RequestInterceptor interceptor = session.RequestInterceptors.Find("OAuth") as OAuth1RequestInterceptor; if (interceptor == null) { throw new InvalidOperationException("Could not locate OAuth request interceptor. Did you call Session.OAuth1Configure()?"); } return(interceptor); }
private static OAuth1Settings GetExistingSettings(ISession session) { OAuth1RequestInterceptor interceptor = GetExistingInterceptor(session); return(interceptor.Settings); }
public static bool OAuth1IsAuthorized(this ISession session) { OAuth1RequestInterceptor interceptor = GetExistingInterceptor(session); return(interceptor.IsAuthorized); }