diff --git a/README.md b/README.md index a49349e..e24d59e 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,8 @@ One can interface with Icarus the music server either by: * [IcarusDownloadManager](https://github.com/amazing-username/IcarusDownloadManager) - ## Built With - * C# [.NET](https://dotnet.microsoft.com/) 6 * [MySql](https://www.nuget.org/packages/MySql.Data/) * OpenSSL @@ -34,69 +32,19 @@ One can interface with Icarus the music server either by: * System.IdentityModel.Tokens.Jwt * [TagLib#](https://github.com/mono/taglib-sharp) -![image](https://user-images.githubusercontent.com/14333136/56252069-28532d00-6084-11e9-896d-1a3c378014ef.png) + ## Getting started + There are several things that need to be completed to properly setup and secure the API. -1. Auth0 API configuration -2. Creating RSA keys -3. API filesystem paths -4. Database connection string -5. Migrations +1. Creating RSA keys +2. API filesystem paths +3. Database connection string +4. Migrations -### Auth0 API configuration - -Securing Icarus is required, preventing the API from being publicly accessible. To do so, create an Auth0 account (it's free), for the sake of this section of the documentation, I will not go over how to create an Auth0 account. Once created, create a tentant and proceed to create an API -

- -

- -Create the API and enter an approrpiate name and identified. For the identified, append **api** like in the example -

- -

-Replace [domain] with the domain name of the created tenant. This can be found in the Default App from the Application menu. Replace [identifier] with the identifer root name in the appsettings environment file. Not the friendly name but the root name of the identifier, omitting the http protocol and the *api* path. - -```Json - "Auth0": { - "Domain": "[domain].auth0.com", - "ApiIdentifier": "https://[identifier]/api" - }, -``` - -For the sake of this section, I will not go over configuring the API to accept the signing algorithm since it has already been configured in the [Startip](Startup.cs).cs file. Click on permissions to create the permissions for the API. -

- -

- -The permissions ensure that a validated user can interact with the API with a token that has not expired. Ensure that the permissions match, the description can change but the permission identifier must match. -

- -

- -On the left side, click on Application and create a new Application. Choose the Machine to Machine Application -

- -

- -With the grant permissions you created from the API, enable all the permissions. This is important because if they are not enabled then even with a valid token the request will return 403 (unauthorized) -

- -

- -From the Application page, copy the client id and client secret. These values will be used for the API to interact with API. -

- -

-Enter the information in the corresponding appsettings json file -```Json - "Auth0": { - "ClientId":"", - "ClientSecret":"" - }, -``` ### Creating RSA keys + 1. Create private key ``` openssl genrsa -out private.pem 2048 @@ -115,6 +63,15 @@ Configure the key paths in the config files } ``` +Replace [domain] with the domain name that represent's your domain. Replace [identifier] with the identifer root name in the appsettings environment file. Not the friendly name but the root name of the identifier, omitting the http protocol and the *api* path. + +```Json +"Auth0": { + "Domain": "[domain].auth0.com", + "ApiIdentifier": "https://[identifier]/api" +}, +``` + ### API filesystem paths For the purposes of properly uploading, downloading, updating, deleting, and streaming songs the API filesystem paths must be configured. What is meant by this is that the `RootMusicPath` directory where all music will be stored must exist as well as the `ArchivePath` and `TemporaryMusicPath` paths. An example on a Linux system: @@ -122,12 +79,14 @@ For the purposes of properly uploading, downloading, updating, deleting, and str { "RootMusicPath": "/home/dev/null/music/", "TemporaryMusicPath": "/home/dev/null/music/temp/", - "ArchivePath": "/home/dev/null/music/archive/" + "ArchivePath": "/home/dev/null/music/archive/", + "CoverArtPath": "/home/dev/null/music/coverart/" } ``` * RootMusicPath - Where music will be stored in the following convention: *`Artist/Album/Songs`* * TemporaryMusicPath - Where music will be stored when uploding songs to the server until the metadata has been fully parsed and entered into the database. Upon completion the files will be deleted and moved to the appropriate path in the `RootMusicPath` * ArchivePath - When downloading compressed songs this is the path where songs will be compressed prior to dataa being read into memory, deleting the compressed file, and sending the compressed file from memory to the client +* CoverArtPath - Root directory where cover art will be saved to **Note**: The `TemporaryMusic` or `ArchivePath` does not have to be located in the `RootMusicPath`. Ensure that the permissions are properly set for all of the paths. @@ -135,15 +94,15 @@ For the purposes of properly uploading, downloading, updating, deleting, and str ### Database connection string In order for Database functionality to be operable, there must be a valid connection string and credentials with appropriate permissions. **At the moment there is only support for MySQL**. Depending on your environment `Release` or `Debug` you will need to edit the appsettings.json or appsettings.Development.json accordingly. An example of the fields to change are below: + ```Json { - "ConnectionStrings": { - "DefaultConnection": "Server=localhost;Database=my_db;Uid=admin;Pwd=toughpassword;" + "DefaultConnection": "Server=localhost;Database=my_db;Uid=admin;Pwd=toughpassword;" } - } ``` + * Server - The address or domain name of the MySQL server * Database - The database name * Uid - Username @@ -181,13 +140,9 @@ From this point the database has been successfully configured. Metadata and song Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the code of conduct, and the process for submitting pull requests to the project. -## Versioning - -* [v0.1](https://github.com/amazing-username/Icarus/releases/tag/v0.1) - ## Authors -* **Kun Deng** - [amazing-username](https://github.com/amazing-username) +* [kdeng00](https://github.com/kdeng00) See also the list of [contributors](https://github.com/amazing-username/Icarus/graphs/contributors) who participated in this project.