internal ConfigurationService(IConfigurationProvider provider, IWebOperationContext context) { if (provider == null) { throw new ArgumentNullException("provider"); } if (context == null) { throw new ArgumentNullException("context"); } m_Provider = provider; m_Context = context; }
protected override void BeginWork() { base.BeginWork(); _bootParameters = Utils.SmartXmlDeserializer(BootParameters) as ProfileBEO; _createdBy = string.Empty; if (_bootParameters.CreatedBy != null) { _createdBy = _bootParameters.CreatedBy; } _modifiedBy = string.Empty; if (_bootParameters.ModifiedBy != null) { _modifiedBy = _bootParameters.ModifiedBy; } _session = EstablishSession(_createdBy); }
/// <summary> /// Initializes a new instance of the <see cref="AtomPubServiceBase"/> class. /// </summary> /// <param name="woContext">The wo context.</param> protected AtomPubServiceBase(IWebOperationContext woContext) { this.webOperationContext = woContext; }
/// <summary> /// Initializes a new instance of the <see cref="AtomPubService"/> class. /// </summary> /// <param name="unitOfWork">The unit of work.</param> /// <param name="woContext">The wo context.</param> public AtomPubService(IUnitOfWork unitOfWork, IWebOperationContext woContext) : base(woContext) { this.unitOfWork = unitOfWork; }
/// <summary> /// Returns response from rest service /// </summary> /// <typeparam name="T"></typeparam> /// <param name="context"></param> /// <param name="statusCode"></param> /// <param name="retVal"></param> /// <returns></returns> public static T RestResponse <T>(IWebOperationContext context, HttpStatusCode statusCode, object retVal) { context.OutgoingResponse.StatusCode = statusCode; return((T)retVal); }
public static Tuple <ServerWithAuthorizationCode, ResourceOwner> GetCredentialsFromAuthorizationRedirect(this IWebOperationContext context) { var code = context.IncomingRequest.UriTemplateMatch.QueryParameters.Get("code"); var state = context.IncomingRequest.UriTemplateMatch.QueryParameters.Get("state"); if (string.IsNullOrEmpty(code)) { throw new InvalidAuthorizationRequestException("the query parameters 'code' is not set."); } if (string.IsNullOrEmpty(state)) { throw new InvalidAuthorizationRequestException("the query parameters 'state' is not set."); } if (!state.Contains("_")) { throw new InvalidAuthorizationRequestException("the query parameters 'state' must be of type '<GUID of Server>_<GUID of ResourceOwner>'"); } var states = state.Split('_'); var server = ServersWithAuthorizationCode.GetServerWithAuthorizationCode(new Guid(states[0])); var resourceOwner = ResourceOwners.GetResourceOwner(new Guid(states[1])); var token = Tokens.GetToken(server, resourceOwner); token.AuthorizationCode = code; return(new Tuple <ServerWithAuthorizationCode, ResourceOwner>(server, resourceOwner)); }
public static void RedirectToAuthorization(this IWebOperationContext context, ServerWithAuthorizationCode server, ResourceOwner resourceOwner) { context.RedirectToAuthorization(server, server.RedirectionUri, resourceOwner); }
public static void RedirectToAuthorization(this IWebOperationContext context, ServerWithAuthorizationCode server, Uri redirectionUri, ResourceOwner resourceOwner) { context.OutgoingResponse.StatusCode = HttpStatusCode.Redirect; SetRedirectUriInToken(server, resourceOwner, redirectionUri); context.OutgoingResponse.Location = GetAuthorizationLocation(server, redirectionUri, resourceOwner); }
public void Dispose() { currentContext = null; }
public MockedWebOperationContext(IWebOperationContext context) { currentContext = context; }