I’ve been able to use the info from here:
To get a basic microservice up and running with Kit. Which is great.
I’ve also been able to get basic authentication mechanisms in place as per the documentation here:
Authorization Facility — Omniverse Developer documentation (nvidia.com)
As the docs describe, the basic auth service only really checks for the existence of the header var, it doesn’t check its contents. So it’s not a security mechanism on its own.
Further, the only real implementation of a validation function within the module seems to be one that loads a set of unencrypted keys into memory from a .toml config setting to check against. Which is very basic. It’s more demo code than a useful implementation. And I’d argue, maybe even a security problem.
There are a few options here to pursue. One would be: pass the buck! Just spin up an HTTP Client and authenticate against some other WebAPI somewhere with the token I’ve been passed. Which doesn’t really match my use-case I don’t think.
Another option would be: Connect to a database backend (probably found via the db facility) and check the api key against the User records in there. That’s pretty standard methodology that you’d expect running a DB via DJango or the like. There seem to be plenty of examples of doing that via FastAPI through something like SQLAlchemy. This is do-able of course. But less desirable than some other options. Maintaining multiple parallel auth datastores seems redundant.
In this case, I’d want to be able to authenticate against Nucleus. Especially since Nucleus already uses api tokens. Infact, I kinda expected there’d be an existing implementation for that. And I was surprised it wasn’t there. A second desire would be to also be able to authorize via the same mechanism.
Am I correct in noting that there isn’t an existing implementation for checking an API key against Nucleus from the perspective of a privileged server daemon?
Am I correct in noting that there isn’t real support for implementing such a thing from omni.client right now, because omni.client seems to be written from the perspective of a user, not a trusted daemon with auth responsibilities? Or is there a good way to do it with the existing API?
Somewhere in the docs, I saw a note that Nucleus’ auth database is just a sqlite db. I’m 99% sure I shouldn’t touch it. Presumably, the nucleus server itself has it open and has it (the file) locked. I shouldn’t really be able to open it form a microservice. Or am I supposed to go down that route (I hope not)?
I’ve dug pretty deep into the farm-queue code to see if I can find some kind of implementation there. But I only really found some usage of a setting that reads:
exts.“omni.services.farm.management.jobs.store”.api_key = “change-me”
So maybe I’m looking in the wrong place.
Any guidance would be appreciated.
-brad