public SkyDriveAuthenticator() { AuthorizationScopes.Add(AuthorizationScope.Login, new[] { "wl.signin" }); AuthorizationScopes.Add(AuthorizationScope.Identity, new[] { "wl.basic" }); AuthorizationScopes.Add(AuthorizationScope.DriveReadOnly, new[] { "wl.skydrive" }); AuthorizationScopes.Add(AuthorizationScope.PhotosAll, new[] { "wl.contacts_photos" }); AuthorizationScopes.Add(AuthorizationScope.ContactsAll, new[] { "wl.contacts_create" }); AuthorizationScopes.Add(AuthorizationScope.Photos, new[] { "wl.photos" }); AuthorizationScopes.Add(AuthorizationScope.DriveAll, new[] { "wl.skydrive_update" }); //Add in-app purchase scopes here. GetAllAuthorizationScopes(); //base.AuthorizationScopes.Add(AuthorizationScope.DriveAll, new[] { "wl.skydrive_update" }); }
public void IsAuthorizedThrowsException(Guid scopeId, ClaimsPrincipal user, ILoggableEntity entity, EventCategory category) { if (isAuthorized(scopeId, user)) { audit.LogSecurityAuditSuccess(user, entity, category); } if (!isAuthorized(scopeId, user)) { string message = string.Format("Access denied: The current user context is not authorized for the scope {0}", AuthorizationScopes.GetScope(scopeId).Name); throw new UnauthorizedAccessException(message); } }
internal static string ToSpotifyString(this AuthorizationScopes authorizationScope) => authorizationScope switch {
/// <summary> /// Initializes a new instance of the <see cref="AccessRefreshToken"/> structure with the specified values. /// </summary> /// <param name="value">A <see cref="string"/> representing the value of the access token.</param> /// <param name="scope">The <see cref="AuthorizationScopes"/> the access token is valid for.</param> /// <param name="expiresIn">The number of seconds after issue at which the access token will expire.</param> /// <param name="refreshToken">A <see cref="string"/> representing a token that can be used to refresh the access token.</param> public AccessRefreshToken(string value, AuthorizationScopes scope, int expiresIn, string?refreshToken) { AccessToken = new(value, scope, expiresIn); RefreshToken = refreshToken; }
/// <summary> /// Initializes a new instance of the <see cref="AccessToken"/> structure with the specified values. /// </summary> /// <param name="value">A <see cref="string"/> representing the value of the access token.</param> /// <param name="scope">The <see cref="AuthorizationScopes"/> the access token is valid for.</param> /// <param name="expiresIn">The number of seconds after issue at which the access token will expire.</param> public AccessToken(string value, AuthorizationScopes scope, int expiresIn) { Value = value; Scope = scope; ExpiresAt = DateTime.UtcNow.AddSeconds(expiresIn); }