Search code examples
javapolicyminio

Is there way to setup user(!) policy using Minio Java Client API?


I want to have an ability to setup user policy using Minio java SDK.

Based on MINIO UI console I can achieve it by:

  1. Add user
  2. Add policy
  3. Assign policy to user

Is there way to achieve it using Minio Java Client API ?


Solution

  • Minio admin client have the methods that you are looking for.

    https://github.com/minio/minio-java/blob/master/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java

    You can achieve what you described with the following functions in the client.

    addUser(..) addCannedPolicy(..) setPolicy(...)