Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (33 sloc) 1.007 kb
using System.Linq;
using ServiceStack;
using ServiceStack.Auth;
using SocialBootstrapApi.Logic;
using SocialBootstrapApi.Models;
namespace SocialBootstrapApi.ServiceInterface
{
public abstract class AppServiceBase : Service
{
public CustomUserSession UserSession
{
get
{
return SessionAs<CustomUserSession>();
}
}
public ITwitterGateway TwitterGateway { get; set; } //Injected in IOC as defined in AppHost
ITwitterGateway authGateway;
public ITwitterGateway AuthTwitterGateway
{
get
{
if (authGateway != null) return authGateway;
var authProvider = AuthenticateService.AuthProviders.FirstOrDefault(x => x is TwitterAuthProvider) as TwitterAuthProvider;
var oAuthTokens = UserSession.GetOAuthTokens(TwitterAuthProvider.Name);
return authGateway = TwitterGateway.CreateAuthroizedGateway(
authProvider,
oAuthTokens != null ? oAuthTokens.AccessToken : null,
oAuthTokens != null ? oAuthTokens.AccessTokenSecret : null);
}
}
}
}
Jump to Line
Something went wrong with that request. Please try again.