// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System.Security.Claims; using Microsoft.Owin; using Microsoft.Owin.Security; using Microsoft.Owin.Security.Provider; using Owin.Security.Providers.ArcGISPortal.Provider; using System; namespace Owin.Security.Providers.ArcGISPortal { /// /// Contains information about the login session as well as the user . /// public class ArcGISPortalAuthenticatedContext : BaseContext { /// /// Initializes a /// /// The OWIN environment /// The ArcGIS Portal user /// ArcGIS Portal Access token /// ArcGIS Portal Refresh token /// ArcGIS Portal Host public ArcGISPortalAuthenticatedContext(IOwinContext context, ArcGISPortalUser user, string accessToken, string refreshToken, string host) : base(context) { Uri hostUri = new Uri(host); AccessToken = accessToken; RefreshToken = refreshToken; Id = user.Username; Name = user.FullName; Link = new Uri(hostUri, "arcgis/sharing/rest/community/users/" + Id).ToString(); UserName = Id; Email = user.Email; } /// /// Gets the ArcGIS Portal access token /// public string AccessToken { get; private set; } /// /// Gets the ArcGIS Portal refresh token /// public string RefreshToken { get; private set; } /// /// Gets the ArcGIS Portal user ID /// public string Id { get; } /// /// Gets the user's name /// public string Name { get; private set; } /// /// Gets the user's email /// public string Email { get; private set; } public string Link { get; private set; } /// /// Gets the ArcGIS Portal username /// public string UserName { get; private set; } /// /// Gets the representing the user /// public ClaimsIdentity Identity { get; set; } /// /// Gets or sets a property bag for common authentication properties /// public AuthenticationProperties Properties { get; set; } } }