mirror of https://github.com/Squidex/squidex.git
Browse Source
* TMerge branch 'master' of github.com:Squidex/squidex into feature/fulltext-search * MCP * Fix tests * Fix tests * Fix tests again * Add missing files * T * Fixes * Fix playwright. * Update node * Fix tests once more.pull/1352/head
committed by
GitHub
130 changed files with 2977 additions and 225 deletions
@ -0,0 +1,18 @@ |
|||
{ |
|||
"version": "0.0.1", |
|||
"configurations": [ |
|||
{ |
|||
"name": "frontend", |
|||
"runtimeExecutable": "npm", |
|||
"runtimeArgs": ["start", "--prefix", "frontend"], |
|||
"port": 3000 |
|||
}, |
|||
{ |
|||
"name": "backend", |
|||
"runtimeExecutable": "dotnet", |
|||
"runtimeArgs": ["run", "--project", "backend/src/Squidex", "--no-launch-profile", "--environment", "Development"], |
|||
"url": "https://localhost:5001", |
|||
"port": 5001 |
|||
} |
|||
] |
|||
} |
|||
@ -0,0 +1,132 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Security.Claims; |
|||
using Squidex.Domain.Apps.Core.Apps; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Infrastructure.Security; |
|||
using Squidex.Shared; |
|||
using Squidex.Shared.Identity; |
|||
|
|||
namespace Squidex.Web.Pipeline; |
|||
|
|||
public static class AppPermissionClaims |
|||
{ |
|||
public static void Enrich(App app, ClaimsPrincipal user) |
|||
{ |
|||
var isFrontend = user.IsInClient(DefaultClients.Frontend); |
|||
|
|||
string? clientId = null; |
|||
|
|||
var (role, permissions) = FindByOpenIdSubject(app, user, isFrontend); |
|||
if (permissions == null) |
|||
{ |
|||
(clientId, role, permissions) = FindByOpenIdClient(app, user, isFrontend); |
|||
} |
|||
|
|||
if (permissions == null) |
|||
{ |
|||
(role, permissions) = FindByUserInfo(app, user, isFrontend); |
|||
} |
|||
|
|||
if (permissions == null) |
|||
{ |
|||
(clientId, role, permissions) = FindAnonymousClient(app, isFrontend); |
|||
} |
|||
|
|||
if (permissions == null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
var identity = user.Identities.First(); |
|||
|
|||
if (!string.IsNullOrWhiteSpace(role)) |
|||
{ |
|||
identity.AddClaim(new Claim(ClaimTypes.Role, role)); |
|||
} |
|||
|
|||
foreach (var permission in permissions) |
|||
{ |
|||
identity.AddClaim(new Claim(SquidexClaimTypes.Permissions, permission.Id)); |
|||
} |
|||
|
|||
if (user.Token() == null && clientId != null) |
|||
{ |
|||
identity.AddClaim(new Claim(OpenIdClaims.ClientId, clientId)); |
|||
} |
|||
} |
|||
|
|||
public static bool HasAppPermission(string appName, Context requestContext) |
|||
{ |
|||
return requestContext.UserPermissions.Includes(PermissionIds.ForApp(PermissionIds.App, appName)); |
|||
} |
|||
|
|||
private static (string?, string?, PermissionSet?) FindByOpenIdClient(App app, ClaimsPrincipal user, bool isFrontend) |
|||
{ |
|||
var (appName, clientId) = user.GetClient(); |
|||
if (app.Name != appName || clientId == null) |
|||
{ |
|||
return default; |
|||
} |
|||
|
|||
if (app.TryGetClientRole(clientId, isFrontend, out var role)) |
|||
{ |
|||
return (clientId, role.Name, role.Permissions); |
|||
} |
|||
|
|||
return default; |
|||
} |
|||
|
|||
private static (string?, PermissionSet?) FindByUserInfo(App app, ClaimsPrincipal user, bool isFrontend) |
|||
{ |
|||
var (_, appName, roleName) = user.GetUserInfo(); |
|||
if (app.Name != appName || roleName == null) |
|||
{ |
|||
return default; |
|||
} |
|||
|
|||
if (app.TryGetRole(roleName, isFrontend, out var role)) |
|||
{ |
|||
return (role.Name, role.Permissions); |
|||
} |
|||
|
|||
return default; |
|||
} |
|||
|
|||
private static (string?, string?, PermissionSet?) FindAnonymousClient(App app, bool isFrontend) |
|||
{ |
|||
var client = app.Clients.FirstOrDefault(x => x.Value.AllowAnonymous); |
|||
if (client.Value == null) |
|||
{ |
|||
return default; |
|||
} |
|||
|
|||
if (app.TryGetRole(client.Value.Role, isFrontend, out var role)) |
|||
{ |
|||
return (client.Key, role.Name, role.Permissions); |
|||
} |
|||
|
|||
return default; |
|||
} |
|||
|
|||
private static (string?, PermissionSet?) FindByOpenIdSubject(App app, ClaimsPrincipal user, bool isFrontend) |
|||
{ |
|||
var subjectId = user.OpenIdSubject(); |
|||
if (subjectId == null) |
|||
{ |
|||
return default; |
|||
} |
|||
|
|||
if (app.TryGetContributorRole(subjectId, isFrontend, out var role)) |
|||
{ |
|||
return (role.Name, role.Permissions); |
|||
} |
|||
|
|||
return default; |
|||
} |
|||
} |
|||
@ -0,0 +1,83 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Globalization; |
|||
using Squidex.Domain.Apps.Core.Apps; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Domain.Apps.Entities.Billing; |
|||
using Squidex.Infrastructure; |
|||
using Squidex.Infrastructure.Security; |
|||
using Squidex.Shared; |
|||
using Squidex.Shared.Identity; |
|||
using Squidex.Web; |
|||
using Squidex.Web.Pipeline; |
|||
|
|||
namespace Squidex.Areas.Mcp.Config; |
|||
|
|||
public sealed class McpAppMiddleware(RequestDelegate next) |
|||
{ |
|||
private static readonly ApiCostsAttribute Costs = new ApiCostsAttribute(1); |
|||
|
|||
public async Task InvokeAsync(HttpContext httpContext, IAppProvider appProvider, IUsageGate usageGate) |
|||
{ |
|||
// The MCP endpoints are minimal API endpoints, therefore the MVC filters for apps and costs do not run.
|
|||
if (httpContext.GetEndpoint()?.Metadata.GetMetadata<McpEndpointMetadata>() == null) |
|||
{ |
|||
await next(httpContext); |
|||
return; |
|||
} |
|||
|
|||
var appName = httpContext.GetRouteValue("app")?.ToString(); |
|||
if (string.IsNullOrWhiteSpace(appName)) |
|||
{ |
|||
httpContext.Response.StatusCode = StatusCodes.Status404NotFound; |
|||
return; |
|||
} |
|||
|
|||
var user = httpContext.User; |
|||
|
|||
var app = await appProvider.GetAppAsync(appName, !user.IsInClient(DefaultClients.Frontend), httpContext.RequestAborted); |
|||
if (app == null) |
|||
{ |
|||
httpContext.Response.StatusCode = StatusCodes.Status404NotFound; |
|||
return; |
|||
} |
|||
|
|||
AppPermissionClaims.Enrich(app, user); |
|||
|
|||
var requestContext = new Context(user, app).WithHeaders(httpContext); |
|||
|
|||
if (!AppPermissionClaims.HasAppPermission(appName, requestContext)) |
|||
{ |
|||
var isAnonymous = string.IsNullOrWhiteSpace(user.Identity?.AuthenticationType); |
|||
|
|||
httpContext.Response.StatusCode = isAnonymous ? StatusCodes.Status401Unauthorized : StatusCodes.Status404NotFound; |
|||
return; |
|||
} |
|||
|
|||
if (await IsBlockedAsync(httpContext, app, usageGate)) |
|||
{ |
|||
httpContext.Response.StatusCode = StatusCodes.Status429TooManyRequests; |
|||
return; |
|||
} |
|||
|
|||
httpContext.Features.Set(requestContext); |
|||
httpContext.Features.Set(app); |
|||
httpContext.Features.Set<IApiCostsFeature>(Costs); |
|||
httpContext.Response.Headers["X-AppId"] = app.Id.ToString(); |
|||
httpContext.Response.Headers["X-Costs"] = Costs.Costs.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
await next(httpContext); |
|||
} |
|||
|
|||
private static Task<bool> IsBlockedAsync(HttpContext httpContext, App app, IUsageGate usageGate) |
|||
{ |
|||
var (_, clientId) = httpContext.User.GetClient(); |
|||
|
|||
return usageGate.IsBlockedAsync(app, clientId, DateTime.Today.ToDateOnly(), httpContext.RequestAborted); |
|||
} |
|||
} |
|||
@ -0,0 +1,118 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Diagnostics.CodeAnalysis; |
|||
using System.Security.Claims; |
|||
using System.Security.Cryptography; |
|||
using System.Text; |
|||
using System.Text.Encodings.Web; |
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.Extensions.Options; |
|||
using Microsoft.Net.Http.Headers; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Infrastructure.Security; |
|||
|
|||
namespace Squidex.Areas.Mcp.Config; |
|||
|
|||
public sealed class McpClientSecretHandler( |
|||
IAppProvider appProvider, |
|||
IOptionsMonitor<AuthenticationSchemeOptions> options, |
|||
ILoggerFactory logger, |
|||
UrlEncoder encoder) |
|||
: AuthenticationHandler<AuthenticationSchemeOptions>(options, logger, encoder) |
|||
{ |
|||
public const string SchemeName = "McpClientSecret"; |
|||
private const string BasicPrefix = "Basic "; |
|||
|
|||
protected override async Task<AuthenticateResult> HandleAuthenticateAsync() |
|||
{ |
|||
if (!TryGetCredentials(Request, out var clientName, out var secret)) |
|||
{ |
|||
return AuthenticateResult.NoResult(); |
|||
} |
|||
|
|||
var appName = Context.GetRouteValue("app")?.ToString(); |
|||
if (string.IsNullOrWhiteSpace(appName)) |
|||
{ |
|||
return AuthenticateResult.Fail("Invalid client."); |
|||
} |
|||
|
|||
var app = await appProvider.GetAppAsync(appName, true, Context.RequestAborted); |
|||
if (app == null) |
|||
{ |
|||
return AuthenticateResult.Fail("Invalid client."); |
|||
} |
|||
|
|||
// Also accept the full client ID, which is shown everywhere in the UI.
|
|||
var appPrefix = $"{app.Name}:"; |
|||
if (clientName.StartsWith(appPrefix, StringComparison.Ordinal)) |
|||
{ |
|||
clientName = clientName[appPrefix.Length..]; |
|||
} |
|||
|
|||
if (!app.Clients.TryGetValue(clientName, out var client)) |
|||
{ |
|||
return AuthenticateResult.Fail("Invalid client."); |
|||
} |
|||
|
|||
if (!CryptographicOperations.FixedTimeEquals(Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes(client.Secret))) |
|||
{ |
|||
return AuthenticateResult.Fail("Invalid client."); |
|||
} |
|||
|
|||
// Same client claim as in a token, so that the app resolution assigns the role of the client.
|
|||
var identity = new ClaimsIdentity( |
|||
[ |
|||
new Claim(OpenIdClaims.ClientId, $"{app.Name}:{clientName}"), |
|||
], SchemeName); |
|||
|
|||
return AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(identity), Scheme.Name)); |
|||
} |
|||
|
|||
public static bool IsClientSecret(HttpContext httpContext) |
|||
{ |
|||
if (httpContext.GetEndpoint()?.Metadata.GetMetadata<McpEndpointMetadata>() == null) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return TryGetCredentials(httpContext.Request, out _, out _); |
|||
} |
|||
|
|||
private static bool TryGetCredentials(HttpRequest request, [MaybeNullWhen(false)] out string clientName, [MaybeNullWhen(false)] out string secret) |
|||
{ |
|||
clientName = null; |
|||
secret = null; |
|||
|
|||
string? header = request.Headers[HeaderNames.Authorization]; |
|||
if (header?.StartsWith(BasicPrefix, StringComparison.OrdinalIgnoreCase) != true) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
string decoded; |
|||
try |
|||
{ |
|||
decoded = Encoding.UTF8.GetString(Convert.FromBase64String(header[BasicPrefix.Length..].Trim())); |
|||
} |
|||
catch (FormatException) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
// Split at the last colon, because the client ID can contain the app name and a colon.
|
|||
var separator = decoded.LastIndexOf(':'); |
|||
if (separator <= 0 || separator == decoded.Length - 1) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
clientName = decoded[..separator]; |
|||
secret = decoded[(separator + 1)..]; |
|||
return true; |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
namespace Squidex.Areas.Mcp.Config; |
|||
|
|||
public sealed class McpEndpointMetadata |
|||
{ |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Squidex.Areas.Mcp.Tools; |
|||
using Squidex.Web; |
|||
|
|||
namespace Squidex.Areas.Mcp.Config; |
|||
|
|||
public static class McpServices |
|||
{ |
|||
public static void AddSquidexMcp(this IServiceCollection services) |
|||
{ |
|||
services.AddMcpServer(options => |
|||
{ |
|||
options.ServerInfo = new () { Name = "Squidex", Version = typeof(McpServices).Assembly.GetName().Version?.ToString() ?? "1.0" }; |
|||
}) |
|||
.WithHttpTransport() |
|||
.WithTools<SchemaTools>() |
|||
.WithTools<ContentTools>() |
|||
.WithTools<AssetTools>(); |
|||
|
|||
// Agents keep their configuration for a long time, so they can use the client secret instead of an expiring token.
|
|||
services.AddAuthentication() |
|||
.AddScheme<AuthenticationSchemeOptions, McpClientSecretHandler>(McpClientSecretHandler.SchemeName, null); |
|||
} |
|||
|
|||
public static void UseSquidexMcp(this IApplicationBuilder app) |
|||
{ |
|||
app.UseMiddleware<McpAppMiddleware>(); |
|||
} |
|||
|
|||
public static void MapSquidexMcp(this IEndpointRouteBuilder endpoints) |
|||
{ |
|||
// Authenticate with the API scheme, but allow anonymous clients. Permissions are checked by the middleware.
|
|||
endpoints.MapMcp($"{Constants.PrefixApi}/apps/{{app}}/mcp") |
|||
.RequireAuthorization(new AuthorizeAttribute { AuthenticationSchemes = Constants.ApiSecurityScheme }) |
|||
.AllowAnonymous() |
|||
.WithMetadata(new McpEndpointMetadata()); |
|||
} |
|||
} |
|||
@ -0,0 +1,91 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.ComponentModel; |
|||
using ModelContextProtocol; |
|||
using ModelContextProtocol.Server; |
|||
using Squidex.Domain.Apps.Core; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Domain.Apps.Entities.Assets; |
|||
using Squidex.Infrastructure; |
|||
using Squidex.Infrastructure.Json; |
|||
using Squidex.Shared; |
|||
|
|||
namespace Squidex.Areas.Mcp.Tools; |
|||
|
|||
[McpServerToolType] |
|||
public sealed class AssetTools(IContextProvider contextProvider, IAssetQueryService assetQuery, IUrlGenerator urlGenerator, IJsonSerializer serializer) |
|||
: McpToolBase(contextProvider, serializer) |
|||
{ |
|||
[McpServerTool(Name = "query_assets", Title = "Query assets", ReadOnly = true, Idempotent = true, OpenWorld = false)] |
|||
[Description("""
|
|||
Queries assets. Use either a JSON query or an OData query. If both are provided, the JSON query is used. |
|||
JSON query example: {"filter": {"path": "fileName", "op": "contains", "value": "logo"}, "sort": [{"path": "lastModified", "order": "descending"}], "take": 20}. |
|||
OData query example: $filter=contains(fileName, 'logo')&$orderby=lastModified desc&$top=20. |
|||
""")]
|
|||
public Task<string> QueryAssets( |
|||
[Description("The optional JSON query.")] string? query = null, |
|||
[Description("The optional OData query, e.g. $filter=mimeType eq 'image/png'&$top=10.")] string? odata = null, |
|||
[Description("The optional ID of the folder. Omit to search in all folders.")] string? parentId = null, |
|||
CancellationToken ct = default) |
|||
{ |
|||
return ExecuteAsync(async context => |
|||
{ |
|||
EnsurePermission(context, PermissionIds.AppAssetsRead); |
|||
|
|||
var parent = string.IsNullOrWhiteSpace(parentId) ? (DomainId?)null : ParseId(parentId); |
|||
|
|||
var q = Q.Empty.WithJsonQuery(query).WithODataQuery(odata); |
|||
|
|||
var assets = await assetQuery.QueryAsync(context, parent, q, ct); |
|||
|
|||
return new |
|||
{ |
|||
assets.Total, |
|||
Items = assets.Select(ToResult).ToList(), |
|||
}; |
|||
}); |
|||
} |
|||
|
|||
[McpServerTool(Name = "get_asset", Title = "Get asset", ReadOnly = true, Idempotent = true, OpenWorld = false)] |
|||
[Description("Gets the metadata of a single asset by ID, including the URL to download the file.")] |
|||
public Task<string> GetAsset( |
|||
[Description("The ID of the asset.")] string id, |
|||
CancellationToken ct = default) |
|||
{ |
|||
return ExecuteAsync(async context => |
|||
{ |
|||
EnsurePermission(context, PermissionIds.AppAssetsRead); |
|||
|
|||
var asset = await assetQuery.FindAsync(context, ParseId(id), ct: ct) |
|||
?? throw new McpException($"Asset '{id}' not found."); |
|||
|
|||
return ToResult(asset); |
|||
}); |
|||
} |
|||
|
|||
private object ToResult(EnrichedAsset asset) |
|||
{ |
|||
return new |
|||
{ |
|||
asset.Id, |
|||
asset.ParentId, |
|||
asset.FileName, |
|||
asset.FileSize, |
|||
asset.MimeType, |
|||
asset.Slug, |
|||
asset.Type, |
|||
asset.IsProtected, |
|||
asset.Metadata, |
|||
Tags = asset.TagNames, |
|||
asset.Version, |
|||
asset.Created, |
|||
asset.LastModified, |
|||
Url = urlGenerator.AssetContent(asset.AppId, asset.Id.ToString()), |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,85 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.ComponentModel; |
|||
using ModelContextProtocol; |
|||
using ModelContextProtocol.Server; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Domain.Apps.Entities.Contents; |
|||
using Squidex.Infrastructure.Json; |
|||
|
|||
namespace Squidex.Areas.Mcp.Tools; |
|||
|
|||
[McpServerToolType] |
|||
public sealed class ContentTools(IContextProvider contextProvider, IContentQueryService contentQuery, IJsonSerializer serializer) |
|||
: McpToolBase(contextProvider, serializer) |
|||
{ |
|||
[McpServerTool(Name = "query_contents", Title = "Query contents", ReadOnly = true, Idempotent = true, OpenWorld = false)] |
|||
[Description("""
|
|||
Queries content items of a schema. Use either a JSON query or an OData query. If both are provided, the JSON query is used. |
|||
JSON query example: {"filter": {"path": "data.title.iv", "op": "contains", "value": "hello"}, "sort": [{"path": "lastModified", "order": "descending"}], "skip": 0, "take": 20}. |
|||
OData query example: $filter=contains(data/title/iv, 'hello')&$orderby=lastModified desc&$skip=0&$top=20. |
|||
Field values are stored per language or with the "iv" key for non-localized fields. Use get_schema to get the field names. |
|||
""")]
|
|||
public Task<string> QueryContents( |
|||
[Description("The name or ID of the schema.")] string schema, |
|||
[Description("The optional JSON query.")] string? query = null, |
|||
[Description("The optional OData query, e.g. $filter=data/title/iv eq 'hello'&$top=10.")] string? odata = null, |
|||
[Description("True to also return unpublished content items.")] bool unpublished = false, |
|||
CancellationToken ct = default) |
|||
{ |
|||
return ExecuteAsync(async context => |
|||
{ |
|||
var q = Q.Empty.WithJsonQuery(query).WithODataQuery(odata); |
|||
|
|||
var contents = await contentQuery.QueryAsync(WithOptions(context, unpublished), schema, q, ct); |
|||
|
|||
return new |
|||
{ |
|||
contents.Total, |
|||
Items = contents.Select(ToResult).ToList(), |
|||
}; |
|||
}); |
|||
} |
|||
|
|||
[McpServerTool(Name = "get_content", Title = "Get content", ReadOnly = true, Idempotent = true, OpenWorld = false)] |
|||
[Description("Gets a single content item by ID.")] |
|||
public Task<string> GetContent( |
|||
[Description("The name or ID of the schema.")] string schema, |
|||
[Description("The ID of the content item.")] string id, |
|||
[Description("True to also return unpublished content items.")] bool unpublished = false, |
|||
CancellationToken ct = default) |
|||
{ |
|||
return ExecuteAsync(async context => |
|||
{ |
|||
var content = await contentQuery.FindAsync(WithOptions(context, unpublished), schema, ParseId(id), ct: ct) |
|||
?? throw new McpException($"Content '{id}' not found."); |
|||
|
|||
return ToResult(content); |
|||
}); |
|||
} |
|||
|
|||
private static Context WithOptions(Context context, bool unpublished) |
|||
{ |
|||
return context.Clone(b => b.WithUnpublished(unpublished)); |
|||
} |
|||
|
|||
private static object ToResult(EnrichedContent content) |
|||
{ |
|||
return new |
|||
{ |
|||
content.Id, |
|||
Schema = content.SchemaId.Name, |
|||
content.Status, |
|||
content.NewStatus, |
|||
content.Version, |
|||
content.Created, |
|||
content.LastModified, |
|||
content.Data, |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using ModelContextProtocol; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Infrastructure; |
|||
using Squidex.Infrastructure.Json; |
|||
using Squidex.Shared; |
|||
|
|||
namespace Squidex.Areas.Mcp.Tools; |
|||
|
|||
public abstract class McpToolBase(IContextProvider contextProvider, IJsonSerializer serializer) |
|||
{ |
|||
protected async Task<string> ExecuteAsync(Func<Context, Task<object?>> action) |
|||
{ |
|||
var context = contextProvider.Context; |
|||
|
|||
// Should never happen, because the middleware resolves the app before.
|
|||
if (context.App == null) |
|||
{ |
|||
throw new McpException("App not found."); |
|||
} |
|||
|
|||
try |
|||
{ |
|||
var result = await action(context); |
|||
|
|||
return serializer.Serialize(result); |
|||
} |
|||
catch (DomainException ex) |
|||
{ |
|||
// Domain exceptions are also exposed by the REST API, so the message is safe to share.
|
|||
throw new McpException(ex.Message, ex); |
|||
} |
|||
} |
|||
|
|||
protected static void EnsurePermission(Context context, string permissionId) |
|||
{ |
|||
if (!context.UserPermissions.Allows(permissionId, context.App.Name)) |
|||
{ |
|||
throw new McpException("You do not have the permission to perform this operation."); |
|||
} |
|||
} |
|||
|
|||
protected static DomainId ParseId(string id) |
|||
{ |
|||
if (string.IsNullOrWhiteSpace(id)) |
|||
{ |
|||
throw new McpException("The ID must not be empty."); |
|||
} |
|||
|
|||
return DomainId.Create(id); |
|||
} |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.ComponentModel; |
|||
using ModelContextProtocol; |
|||
using ModelContextProtocol.Server; |
|||
using Squidex.Areas.Api.Controllers.Schemas.Models; |
|||
using Squidex.Domain.Apps.Core.Schemas; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Infrastructure.Json; |
|||
using Squidex.Shared; |
|||
|
|||
namespace Squidex.Areas.Mcp.Tools; |
|||
|
|||
[McpServerToolType] |
|||
public sealed class SchemaTools(IContextProvider contextProvider, IAppProvider appProvider, IJsonSerializer serializer) |
|||
: McpToolBase(contextProvider, serializer) |
|||
{ |
|||
[McpServerTool(Name = "list_schemas", Title = "List schemas", ReadOnly = true, Idempotent = true, OpenWorld = false)] |
|||
[Description("Lists all schemas of the app with name, type and label. Use get_schema to get the fields of a schema.")] |
|||
public Task<string> ListSchemas(CancellationToken ct) |
|||
{ |
|||
return ExecuteAsync(async context => |
|||
{ |
|||
EnsurePermission(context, PermissionIds.AppSchemasRead); |
|||
|
|||
var schemas = await appProvider.GetSchemasAsync(context.App.Id, ct); |
|||
|
|||
return schemas.OrderBy(x => x.Name).Select(x => new |
|||
{ |
|||
x.Name, |
|||
x.Type, |
|||
x.Category, |
|||
x.IsPublished, |
|||
x.Properties.Label, |
|||
x.Properties.Hints, |
|||
}).ToList(); |
|||
}); |
|||
} |
|||
|
|||
[McpServerTool(Name = "get_schema", Title = "Get schema", ReadOnly = true, Idempotent = true, OpenWorld = false)] |
|||
[Description("Gets a schema with all fields. The field names are the keys in the data of content items.")] |
|||
public Task<string> GetSchema( |
|||
[Description("The name or ID of the schema.")] string schema, |
|||
CancellationToken ct = default) |
|||
{ |
|||
return ExecuteAsync(async context => |
|||
{ |
|||
EnsurePermission(context, PermissionIds.AppSchemasRead); |
|||
|
|||
var result = await appProvider.GetSchemaAsync(context.App.Id, schema, true, ct) |
|||
?? throw new McpException($"Schema '{schema}' not found."); |
|||
|
|||
return new |
|||
{ |
|||
result.Name, |
|||
result.Type, |
|||
result.Category, |
|||
result.IsPublished, |
|||
result.Properties.Label, |
|||
result.Properties.Hints, |
|||
Fields = result.Fields.Select(FieldDto.FromDomain).ToList(), |
|||
}; |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using ModelContextProtocol.Client; |
|||
using TestSuite.Fixtures; |
|||
|
|||
namespace TestSuite.ApiTests; |
|||
|
|||
public sealed class McpFixture : TestSchemaFixtureBase |
|||
{ |
|||
public McpFixture() |
|||
: base("my-mcp") |
|||
{ |
|||
} |
|||
|
|||
public string McpUrl(string appName) |
|||
{ |
|||
return Client.GenerateUrl($"api/apps/{appName}/mcp")!; |
|||
} |
|||
|
|||
public Task<McpClient> CreateMcpClientAsync(HttpClient? httpClient = null, string? appName = null) |
|||
{ |
|||
var transport = new HttpClientTransport(new HttpClientTransportOptions |
|||
{ |
|||
Endpoint = new Uri(McpUrl(appName ?? AppName)), |
|||
}, httpClient ?? Client.CreateHttpClient()); |
|||
|
|||
return McpClient.CreateAsync(transport); |
|||
} |
|||
} |
|||
@ -0,0 +1,428 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Net; |
|||
using System.Net.Http.Headers; |
|||
using System.Text; |
|||
using ModelContextProtocol; |
|||
using ModelContextProtocol.Client; |
|||
using ModelContextProtocol.Protocol; |
|||
using Newtonsoft.Json; |
|||
using Newtonsoft.Json.Linq; |
|||
using Squidex.ClientLibrary; |
|||
using TestSuite.Model; |
|||
|
|||
#pragma warning disable SA1300 // Element should begin with upper-case letter
|
|||
#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row
|
|||
|
|||
namespace TestSuite.ApiTests; |
|||
|
|||
public class McpTests(McpFixture fixture) : IClassFixture<McpFixture> |
|||
{ |
|||
public McpFixture _ { get; } = fixture; |
|||
|
|||
[Fact] |
|||
public async Task Should_list_tools() |
|||
{ |
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var tools = await mcp.ListToolsAsync(); |
|||
|
|||
// Snapshot the full definitions, because the descriptions and schemas are what the agents see.
|
|||
await VerifyJson(System.Text.Json.JsonSerializer.Serialize( |
|||
tools.Select(x => x.ProtocolTool).OrderBy(x => x.Name), |
|||
McpJsonUtilities.DefaultOptions)); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_list_schemas() |
|||
{ |
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
// The fixture app is shared with other tests, which create their own schemas.
|
|||
var result = JToken.Parse(await CallAsync(mcp, "list_schemas")); |
|||
|
|||
Assert.Contains(result, x => (string?)x["name"] == _.SchemaName); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_get_schema() |
|||
{ |
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "get_schema", new () |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
}); |
|||
|
|||
await VerifyJson(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_query_contents_with_json() |
|||
{ |
|||
// STEP 1: Create a published content item with a unique value.
|
|||
var value = Guid.NewGuid().ToString(); |
|||
|
|||
await _.Contents.CreateAsync(new TestEntityData { String = value }, ContentCreateOptions.AsPublish); |
|||
|
|||
|
|||
// STEP 2: Query the content item.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "query_contents", new () |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
["query"] = JsonConvert.SerializeObject(new |
|||
{ |
|||
filter = new { path = $"data.{TestEntityData.StringField}.iv", op = "eq", value }, |
|||
}), |
|||
}); |
|||
|
|||
await VerifyJson(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_query_contents_with_odata() |
|||
{ |
|||
// STEP 1: Create published content items with a unique value.
|
|||
var value = Guid.NewGuid().ToString(); |
|||
|
|||
await _.Contents.CreateAsync( |
|||
new TestEntityData { String = value, Number = 1 }, |
|||
ContentCreateOptions.AsPublish); |
|||
|
|||
await _.Contents.CreateAsync( |
|||
new TestEntityData { String = value, Number = 2 }, |
|||
ContentCreateOptions.AsPublish); |
|||
|
|||
|
|||
// STEP 2: Query the content items with filter and sorting.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "query_contents", new () |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
["odata"] = $"$filter=data/{TestEntityData.StringField}/iv eq '{value}'&$orderby=data/{TestEntityData.NumberField}/iv desc", |
|||
}); |
|||
|
|||
await VerifyJson(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_not_query_unpublished_contents_by_default() |
|||
{ |
|||
// STEP 1: Create an unpublished content item with a unique value.
|
|||
var value = Guid.NewGuid().ToString(); |
|||
|
|||
await _.Contents.CreateAsync(new TestEntityData { String = value }); |
|||
|
|||
|
|||
// STEP 2: Query the content item.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "query_contents", new () |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
["query"] = JsonConvert.SerializeObject(new |
|||
{ |
|||
filter = new { path = $"data.{TestEntityData.StringField}.iv", op = "eq", value }, |
|||
}), |
|||
}); |
|||
|
|||
await VerifyJson(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_query_unpublished_contents_if_requested() |
|||
{ |
|||
// STEP 1: Create an unpublished content item with a unique value.
|
|||
var value = Guid.NewGuid().ToString(); |
|||
|
|||
await _.Contents.CreateAsync(new TestEntityData { String = value }); |
|||
|
|||
|
|||
// STEP 2: Query the content item.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "query_contents", new () |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
["query"] = JsonConvert.SerializeObject(new |
|||
{ |
|||
filter = new { path = $"data.{TestEntityData.StringField}.iv", op = "eq", value }, |
|||
}), |
|||
["unpublished"] = true, |
|||
}); |
|||
|
|||
await VerifyJson(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_get_content() |
|||
{ |
|||
// STEP 1: Create a published content item.
|
|||
var content = await _.Contents.CreateAsync( |
|||
new TestEntityData { Number = 42 }, |
|||
ContentCreateOptions.AsPublish); |
|||
|
|||
|
|||
// STEP 2: Get the content item.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "get_content", new () |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
["id"] = content.Id, |
|||
}); |
|||
|
|||
await VerifyJson(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_return_error_if_schema_not_found() |
|||
{ |
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await mcp.CallToolAsync("get_content", new Dictionary<string, object?> |
|||
{ |
|||
["schema"] = "unknown", |
|||
["id"] = Guid.NewGuid().ToString(), |
|||
}); |
|||
|
|||
await Verify(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_return_error_if_odata_query_is_invalid() |
|||
{ |
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await mcp.CallToolAsync("query_contents", new Dictionary<string, object?> |
|||
{ |
|||
["schema"] = _.SchemaName, |
|||
["odata"] = "$filter=invalid(", |
|||
}); |
|||
|
|||
await Verify(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_get_asset() |
|||
{ |
|||
// STEP 1: Upload an asset.
|
|||
var asset = await _.Client.Assets.UploadFileAsync("Assets/logo-squared.png", "image/png"); |
|||
|
|||
|
|||
// STEP 2: Get the asset.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "get_asset", new () |
|||
{ |
|||
["id"] = asset.Id, |
|||
}); |
|||
|
|||
await VerifyJson(result) |
|||
.ScrubInlineGuids() |
|||
.AddScrubber(x => x.Replace(_.Url.TrimEnd('/'), "{url}")); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_query_assets_with_json() |
|||
{ |
|||
// STEP 1: Upload an asset.
|
|||
var asset = await _.Client.Assets.UploadFileAsync("Assets/logo-squared.png", "image/png"); |
|||
|
|||
|
|||
// STEP 2: Query the asset.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "query_assets", new () |
|||
{ |
|||
["query"] = JsonConvert.SerializeObject(new |
|||
{ |
|||
filter = new { path = "id", op = "eq", value = asset.Id }, |
|||
}), |
|||
}); |
|||
|
|||
await VerifyJson(result) |
|||
.ScrubInlineGuids() |
|||
.AddScrubber(x => x.Replace(_.Url.TrimEnd('/'), "{url}")); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_query_assets_with_odata() |
|||
{ |
|||
// STEP 1: Upload an asset.
|
|||
var asset = await _.Client.Assets.UploadFileAsync("Assets/logo-squared.png", "image/png"); |
|||
|
|||
|
|||
// STEP 2: Query the asset.
|
|||
await using var mcp = await _.CreateMcpClientAsync(); |
|||
|
|||
var result = await CallAsync(mcp, "query_assets", new () |
|||
{ |
|||
["odata"] = $"$filter=id eq '{asset.Id}'", |
|||
}); |
|||
|
|||
await VerifyJson(result) |
|||
.ScrubInlineGuids() |
|||
.AddScrubber(x => x.Replace(_.Url.TrimEnd('/'), "{url}")); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_return_401_if_not_authenticated() |
|||
{ |
|||
using var httpClient = new HttpClient(); |
|||
|
|||
var response = await PostToolsListAsync(httpClient, _.McpUrl(_.AppName)); |
|||
|
|||
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_return_404_if_app_not_found() |
|||
{ |
|||
using var httpClient = _.Client.CreateHttpClient(); |
|||
|
|||
var response = await PostToolsListAsync(httpClient, _.McpUrl(Guid.NewGuid().ToString())); |
|||
|
|||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_allow_anonymous_access_if_client_is_anonymous() |
|||
{ |
|||
// STEP 1: Create app.
|
|||
var (app, _) = await _.PostAppAsync(); |
|||
|
|||
|
|||
// STEP 2: Make the client anonymous.
|
|||
await app.Apps.PutClientAsync("default", new UpdateClientDto { AllowAnonymous = true }); |
|||
|
|||
|
|||
// STEP 3: Use MCP without authentication.
|
|||
using var httpClient = new HttpClient(); |
|||
|
|||
await using var mcp = await _.CreateMcpClientAsync(httpClient, app.Options.AppName); |
|||
|
|||
var result = await mcp.CallToolAsync("list_schemas"); |
|||
|
|||
await Verify(result); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData(true)] |
|||
[InlineData(false)] |
|||
public async Task Should_authenticate_with_client_secret(bool fullClientId) |
|||
{ |
|||
// STEP 1: Create app and get the secret of the default client.
|
|||
var (app, _) = await _.PostAppAsync(); |
|||
|
|||
var client = (await app.Apps.GetClientsAsync()).Items.Single(x => x.Id == "default"); |
|||
|
|||
|
|||
// STEP 2: Use MCP with the client secret.
|
|||
using var httpClient = CreateBasicClient( |
|||
fullClientId ? $"{app.Options.AppName}:{client.Id}" : client.Id, |
|||
client.Secret); |
|||
|
|||
await using var mcp = await _.CreateMcpClientAsync(httpClient, app.Options.AppName); |
|||
|
|||
var result = await mcp.CallToolAsync("list_schemas"); |
|||
|
|||
await Verify(result); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_return_401_if_client_secret_is_invalid() |
|||
{ |
|||
// STEP 1: Create app.
|
|||
var (app, _) = await _.PostAppAsync(); |
|||
|
|||
|
|||
// STEP 2: Use MCP with a wrong secret.
|
|||
using var httpClient = CreateBasicClient("default", "invalid"); |
|||
|
|||
var response = await PostToolsListAsync(httpClient, _.McpUrl(app.Options.AppName)); |
|||
|
|||
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_return_401_if_client_secret_is_used_for_other_app() |
|||
{ |
|||
// STEP 1: Create two apps.
|
|||
var (app1, _) = await _.PostAppAsync(); |
|||
var (app2, _) = await _.PostAppAsync(); |
|||
|
|||
var client = (await app1.Apps.GetClientsAsync()).Items.Single(x => x.Id == "default"); |
|||
|
|||
|
|||
// STEP 2: Use the secret of the first app for the second app.
|
|||
using var httpClient = CreateBasicClient($"{app1.Options.AppName}:{client.Id}", client.Secret); |
|||
|
|||
var response = await PostToolsListAsync(httpClient, _.McpUrl(app2.Options.AppName)); |
|||
|
|||
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_not_accept_client_secret_outside_of_mcp() |
|||
{ |
|||
// STEP 1: Create app.
|
|||
var (app, _) = await _.PostAppAsync(); |
|||
|
|||
var client = (await app.Apps.GetClientsAsync()).Items.Single(x => x.Id == "default"); |
|||
|
|||
|
|||
// STEP 2: Use the client secret for the REST API.
|
|||
using var httpClient = CreateBasicClient(client.Id, client.Secret); |
|||
|
|||
var response = await httpClient.GetAsync( |
|||
_.Client.GenerateUrl($"api/apps/{app.Options.AppName}/settings")); |
|||
|
|||
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); |
|||
} |
|||
|
|||
private static HttpClient CreateBasicClient(string clientId, string secret) |
|||
{ |
|||
var httpClient = new HttpClient(); |
|||
|
|||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( |
|||
"Basic", |
|||
Convert.ToBase64String(Encoding.UTF8.GetBytes($"{clientId}:{secret}"))); |
|||
return httpClient; |
|||
} |
|||
|
|||
private static async Task<string> CallAsync(McpClient mcp, string tool, |
|||
Dictionary<string, object?>? arguments = null) |
|||
{ |
|||
var result = await mcp.CallToolAsync(tool, arguments ?? []); |
|||
|
|||
var text = Assert.Single(result.Content.OfType<TextContentBlock>()).Text; |
|||
Assert.NotEqual(true, result.IsError); |
|||
|
|||
return text; |
|||
} |
|||
|
|||
private static Task<HttpResponseMessage> PostToolsListAsync(HttpClient httpClient, string url) |
|||
{ |
|||
var request = new HttpRequestMessage(HttpMethod.Post, url) |
|||
{ |
|||
Content = new StringContent( |
|||
"""{"jsonrpc":"2.0","id":1,"method":"tools/list"}""", |
|||
Encoding.UTF8, |
|||
"application/json"), |
|||
}; |
|||
|
|||
request.Headers.Accept.ParseAdd("application/json"); |
|||
request.Headers.Accept.ParseAdd("text/event-stream"); |
|||
|
|||
return httpClient.SendAsync(request); |
|||
} |
|||
} |
|||
@ -1,16 +1,20 @@ |
|||
{ |
|||
Id: Guid_1, |
|||
Secret: {Scrubbed}, |
|||
Name: Guid_1, |
|||
Role: Editor, |
|||
AllowAnonymous: false, |
|||
Links: { |
|||
delete: { |
|||
Href: {Scrubbed}, |
|||
Method: DELETE |
|||
}, |
|||
secret: { |
|||
Href: {Scrubbed}, |
|||
Method: PUT |
|||
}, |
|||
update: { |
|||
Href: {Scrubbed}, |
|||
Method: PUT |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,15 @@ |
|||
{ |
|||
ContributorId: {Scrubbed}, |
|||
ContributorName: {Scrubbed}, |
|||
ContributorEmail: {Scrubbed}, |
|||
Role: Developer, |
|||
Links: { |
|||
delete: { |
|||
Href: {Scrubbed}, |
|||
Method: DELETE |
|||
}, |
|||
update: { |
|||
Href: {Scrubbed}, |
|||
Method: POST |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,13 @@ |
|||
{ |
|||
Name: {Scrubbed}, |
|||
IsDefaultRole: false, |
|||
Links: { |
|||
delete: { |
|||
Href: {Scrubbed}, |
|||
Method: DELETE |
|||
}, |
|||
update: { |
|||
Href: {Scrubbed}, |
|||
Method: PUT |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,13 @@ |
|||
{ |
|||
Name: {Scrubbed}, |
|||
IsDefaultRole: false, |
|||
Links: { |
|||
delete: { |
|||
Href: {Scrubbed}, |
|||
Method: DELETE |
|||
}, |
|||
update: { |
|||
Href: {Scrubbed}, |
|||
Method: PUT |
|||
} |
|||
} |
|||
|
|||
@ -1,9 +1,11 @@ |
|||
{ |
|||
Links: { |
|||
create: { |
|||
Href: {Scrubbed}, |
|||
Method: POST |
|||
}, |
|||
self: { |
|||
Href: {Scrubbed}, |
|||
Method: GET |
|||
} |
|||
} |
|||
|
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue