A client library for communicating with the Orchard Core web APIs. Currently, it contains an implementation for the tenant and content management APIs and a console application for testing and demonstration.
Do you want to quickly try out this project and see it in action? Check it out in our Open-Source Orchard Core Extensions full Orchard Core solution and also see our other useful Orchard Core-related open-source projects!
This project is about creating, setting up, and editing tenants through an API Client using Refit. The project requires the Tenants feature and OpenId features to be enabled and set up. For easy use, enable the Deployment feature and import this recipe as a deployment package.
If you want to set up the OpenId features without the recipe, you need to enable these features:
- OpenID Authorization Server
- OpenID Core Components
- OpenID Management Interface
- OpenID Token Validation
- On the Admin Dashboard open Security → OpenID Connect → Settings → Authorization server, and make sure that the "Enable Token Endpoint" and "Allow Client Credentials Flow" are enabled, and the Token Format should be JSON Web Token.
- Head over to Security → OpenID Connect → Settings → Token validation, and make sure the Authorization server tenant is set to Default.
- Last, but not least, go to Security → OpenID Connect → Management → Applications. Here you can add your applications and you may specify your Client Id and Client Secret. The application will use these parameters for authentication since the application uses Client Credentials Flow. The Allow Client Credentials Flow option should be enabled, and under Client Credentials Roles, the Administrator role is required.
For testing, run your Orchard Core app first, then Lombiq.OrchardCoreApiClient.Tester
. You may need to edit the Program.cs according to your OpenID Application's settings (ClientId
, ClientSecret
, and DefaultTenantUri
) and then run the console application.
You can add your own API endpoints by creating a new interface that's inherited from IOrchardCoreApi
and add your own methods. For example, you can create a new interface called IOrchardCoreApiExtended
and add a new method to it:
public interface IOrchardCoreApiExtended : IOrchardCoreApi
{
[Post("/api/my-custom-endpoint")]
[Headers(AuthorizationBearer)]
Task<string> GetMyCustomEndpointAsync();
}
Lombiq OrchardCore API Client OpenId - Recipe for enabling the Content Types, Tenants and OpenId features and setting it up for the console tester application. To use this recipe, enable the Deployment feature and import this as a deployment package.
Bug reports, feature requests, comments, questions, code contributions and love letters are warmly welcome. You can send them to us via GitHub issues and pull requests. Please adhere to our open-source guidelines while doing so.
This project is developed by Lombiq Technologies. Commercial-grade support is available through Lombiq.