Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to load test data in docker? #5700

Closed
CyborTronik opened this issue May 19, 2023 · 5 comments · Fixed by #5797
Closed

Is there a way to load test data in docker? #5700

CyborTronik opened this issue May 19, 2023 · 5 comments · Fixed by #5797
Labels
question Further information is requested

Comments

@CyborTronik
Copy link

CyborTronik commented May 19, 2023

Context:
I write an app (experiment with Spring boot service). For security I need an auth service. Ideally is to reuse an existing solution like Authentik. During the development phase I do write integration and system tests. Which means I need to run the auth service during those tests. For that a docker-compose was configured which looks to be fine for now.

Question:
Can I configure (or automate) authentik, so during docker start it would load few test users and an app credentials that I can use in tests?

Thanks

@CyborTronik CyborTronik added the question Further information is requested label May 19, 2023
@BeryJu
Copy link
Member

BeryJu commented May 21, 2023

You can do that with blueprints, see https://goauthentik.io/developer-docs/blueprints/

for example the blueprint I use for some testing users:

# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
version: 1
metadata:
  name: local - dev users & groups
  labels:
    blueprints.goauthentik.io/instantiate: "false"
entries:
  - model: authentik_core.group
    identifiers:
      name: Department foo
    id: group_foo
  - model: authentik_core.group
    identifiers:
      name: Department bar
    id: group_bar
  - model: authentik_core.group
    identifiers:
      name: Department baz
    id: group_baz
  - model: authentik_core.user
    identifiers:
      attributes:
        managed: "user1"
    attrs:
      username: user1
      name: user1
      groups:
        - !KeyOf group_foo
  - model: authentik_core.user
    identifiers:
      attributes:
        managed: "user2"
    attrs:
      username: user2
      name: user2
      groups:
        - !KeyOf group_bar
        - !KeyOf group_foo
  - model: authentik_core.user
    identifiers:
      attributes:
        managed: "user3"
    attrs:
      username: user3
      name: user3
      groups:
        - !KeyOf group_baz
        - !KeyOf group_bar

@CyborTronik
Copy link
Author

Thank you @BeryJu , Looks good, however is not clear to set the passwords - which seems to be a blocker

@CyborTronik
Copy link
Author

Use case scenario context below:
I do want to write an app, and the idea is to focus on the solution:

  • As many auth services are available on the market, only few offers local docker support (which is essential if you want to use best practices). That's why authentik has a good spot
  • For automation tests there should be some data loaded into it: users (with passwords) and roles
  • Another essential precondition is to have the application(client) registered properly: also automated data (app id and secret)
  • A really nice to have (or maybe even crucial if the target audience is developers) is to have an article (example) on how to use it with an web service (backend only could be enough). Doesn't matter the stack ,a popular one best for SEO.

@CyborTronik
Copy link
Author

It feels like something has been fixed but not released yet

@BeryJu
Copy link
Member

BeryJu commented May 30, 2023

The PR above adds support to set user's passwords via blueprints, and will be released with 2023.6 (and also usable with the current beta version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants