|
| 1 | +# Copyright 2025 Planet Labs PBC. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +""" |
| 16 | +# The Planet Authentication Library Configration Injection Package: `planet_auth_config_injection` |
| 17 | +
|
| 18 | +This package provides interfaces and utilities for higher-level applications |
| 19 | +to inject configuration into the Planet Authentication Library. |
| 20 | +
|
| 21 | +The Planet Auth Library provides configuration injection to improve the |
| 22 | +end-user experience of tools built on top of the Planet Auth Library. |
| 23 | +This allows built-in default client configurations to be provided. |
| 24 | +Namespacing may also be configured to avoid collisions in the Auth Library's |
| 25 | +use of environment variables. Injected configration is primarily consumed |
| 26 | +by initialization functionality in planet_auth_utils.PlanetAuthFactory |
| 27 | +and the various planet_auth_utils provided `click` commands. |
| 28 | +
|
| 29 | +These concerns belong more to the final end-user application than to a |
| 30 | +library that sits between the Planet Auth library and the end-user |
| 31 | +application. Such libraries themselves may be used by a variety of |
| 32 | +applications in any number of deployment environments, making the |
| 33 | +decision of what configuration to inject a difficult one. |
| 34 | +
|
| 35 | +Library writers may provide configuration injection to their developers, |
| 36 | +but should be conscious of the fact that multiple libraries within an |
| 37 | +application may depend on Planet Auth libraries. Library writers are |
| 38 | +advised to provide configuration injection as an option for their users, |
| 39 | +and not silently force it into the loaded. |
| 40 | +
|
| 41 | +In order to inject configuration, the application writer must do two things: |
| 42 | +
|
| 43 | +1. They must write a class that implements the |
| 44 | + [planet_auth_config_injection.BuiltinConfigurationProviderInterface][] |
| 45 | + interface. |
| 46 | +2. They must set the environment variable `PL_AUTH_BUILTIN_CONFIG_PROVIDER` to the |
| 47 | + fully qualified package, module, and class name of their implementation |
| 48 | + _before_ any import of the `planet_auth` or `planet_auth_utils` packages. |
| 49 | +""" |
| 50 | + |
| 51 | +from .builtins_provider import ( |
| 52 | + AUTH_BUILTIN_PROVIDER, |
| 53 | + BuiltinConfigurationProviderInterface, |
| 54 | + EmptyBuiltinProfileConstants, |
| 55 | +) |
| 56 | + |
| 57 | +__all__ = [ |
| 58 | + "AUTH_BUILTIN_PROVIDER", |
| 59 | + "BuiltinConfigurationProviderInterface", |
| 60 | + "EmptyBuiltinProfileConstants", |
| 61 | +] |
0 commit comments