public GetIncidentsByTicketCreateIfNeededRequest( string ticketId, AuthenticatedUserContext userContext ) : base(userContext) { TicketId = ticketId; }
public GetUncorrelatedEventsRequest(PaginationMetadata pagination, EventFilters filter, AuthenticatedUserContext userContext) : base(userContext) { Pagination = pagination; Filter = filter; }
public GetEventsRequest(long incidentId, PaginationMetadata pagination, EventFilters filter, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; Pagination = pagination; Filter = filter; }
public void Setup() { claimsIdentity = new ClaimsIdentity(); claimsIdentity.AddClaim(new Claim(ClaimType.Permission, Permission)); claimsIdentity.AddClaim(new Claim(ClaimType.Permission, "OtherPermission")); claimsIdentity.AddClaim(new Claim(ClaimType.Role, Role)); claimsIdentity.AddClaim(new Claim(ClaimType.Role, "OtherRole")); claimsIdentity.AddClaim(new Claim(ClaimType.Group, Group)); claimsIdentity.AddClaim(new Claim(ClaimType.Group, "OtherGroup")); sut = new AuthenticatedUserContext(claimsIdentity); }
public PostEventRequest( long incidentId, NewEvent newEvent, AuthenticatedUserContext userContext, Lazy <string> lazyToken, int?port ) : base(userContext) { IncidentId = incidentId; NewEvent = ThrowIf.Null(newEvent, nameof(newEvent)); LazyToken = ThrowIf.Null(lazyToken, nameof(lazyToken)); Port = port; }
public static async Task <string> AcquireTokenAsync(AuthenticatedUserContext authenticationInfo) { //Todo: per-user auth based on delegated identity //string userObjectID = (authenticationInfo.User.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier"))?.Value; string userObjectID = "Test"; var authContext = new AuthenticationContext(authenticationInfo.AuthConfig.Authority, new NaiveSessionCache(userObjectID, authenticationInfo.Session)); var credential = new ClientCredential(authenticationInfo.AuthConfig.ClientId, authenticationInfo.AuthConfig.ClientSecret); try { var result = await authContext.AcquireTokenSilentAsync(authenticationInfo.AuthConfig.Resource, credential, new UserIdentifier(userObjectID, UserIdentifierType.UniqueId)); return(result.AccessToken); } catch (AdalSilentTokenAcquisitionException) { var result = await authContext.AcquireTokenAsync(authenticationInfo.AuthConfig.Resource, credential); return(result.AccessToken); } }
protected AuthenticatedRequestBase(AuthenticatedUserContext userContext) { UserContext = userContext; }
public GetIncidentRequest(long id, AuthenticatedUserContext userContext) : base(userContext) { Id = id; }
public GetEventTypesRequest(AuthenticatedUserContext userContext) : base(userContext) { }
public PostIncidentRequest(NewIncident incident, AuthenticatedUserContext userContext) : base(userContext) { Incident = incident; }
public PutEngagementRequest(long incidentId, long engagementId, UpdateEngagement updateEngagement, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; UpdateEngagement = updateEngagement; EngagementId = engagementId; }
public static async Task <HttpResponseMessage> GetAsync(this HttpClient client, string requestUri, AuthenticatedUserContext authenticationInfo) { return(await client .SendAsync(requestUri, authenticationInfo, HttpMethod.Get) .ConfigureAwait(continueOnCapturedContext: false)); }
public PostEngagementRequest(long incidentId, NewEngagement newEngagement, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; NewEngagement = newEngagement; }
public GetEventRequest(long incidentId, long id, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; Id = id; }
public GetEventTypeRequest(long id, AuthenticatedUserContext userContext) : base(userContext) { EventTypeId = id; }
public PutEngagementRequest(long incidentId, long engagementId, UpdateEngagement updateEngagement, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; UpdateEngagement = ThrowIf.Null(updateEngagement, nameof(updateEngagement)); EngagementId = engagementId; }
public static async Task <HttpResponseMessage> GetAsync(this HttpClient client, string requestUri, AuthenticatedUserContext authenticationInfo) { return(await client.SendAsync(requestUri, authenticationInfo, HttpMethod.Get)); }
private static async Task <HttpRequestMessage> GenerateRequest(string requestUri, AuthenticatedUserContext authenticationInfo, HttpMethod method) { var tokenResult = await AcquireTokenAsync(authenticationInfo); var request = new HttpRequestMessage(method, requestUri); request.Headers.Authorization = new AuthenticationHeaderValue(authenticationInfo.AuthConfig.Scheme, tokenResult); return(request); }
private static async Task <HttpResponseMessage> SendAsync(this HttpClient client, string requestUri, HttpContent postContent, AuthenticatedUserContext authenticationInfo, HttpMethod method) { HttpRequestMessage request = await GenerateRequest(requestUri, authenticationInfo, method); request.Content = postContent; return(await client.SendAsync(request)); }
public PostEngagementRequest(long incidentId, NewEngagement newEngagement, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; NewEngagement = ThrowIf.Null(newEngagement, nameof(newEngagement)); }
protected AuthenticatedRequest(AuthenticatedUserContext userContext) : base(userContext) { }
public GetIncidentsRequest(PaginationMetadata pagination, AuthenticatedUserContext userContext) : base(userContext) { Pagination = pagination; }
public PostIncidentRequest(NewIncident incident, AuthenticatedUserContext userContext) : base(userContext) { Incident = ThrowIf.Null(incident, nameof(incident)); }
public GetGlobalActionsRequest(AuthenticatedUserContext userContext) : base(userContext) { }
private static async Task <HttpResponseMessage> SendAsync(this HttpClient client, string requestUri, AuthenticatedUserContext authenticationInfo, HttpMethod method) { HttpRequestMessage request = await GenerateRequest(requestUri, authenticationInfo, method) .ConfigureAwait(continueOnCapturedContext: false); return(await client.SendAsync(request).ConfigureAwait(continueOnCapturedContext: false)); }