Security layer for Poems API (To do in class on Thursday)

Create the security routes

  1. Create the following routes:

    • POST /register // Open for everyone
    • POST /login // Open for everyone
    • GET /poems // only for users with the role USER
    • GET /poems/{id} // only for users with the role USER
    • POST /poems // only for users with the role ADMIN
    • PUT /poems/{id} // only for users with the role ADMIN
    • DELETE /poems/{id} // only for users with the role ADMIN
  2. In case you don’t have a Poems API. In Lyngby, you can clone this one:

       git clone --branch architecture https://github.com/jonbertelsen/poems.git
    

    If you do, then pay attention to the routes, that might be a little different from ones above. However, the plan is to only allow ADMIN users to create, update, and delete poems, while all users can read poems.


Top

3. semester efterår 2024