mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
docs: correct documentation for enforced authentication type (#25142)
This commit is contained in:
@@ -505,15 +505,19 @@ events. For more information, see the [telemetry documentation](./telemetry.md).
|
|||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
You can enforce a specific authentication method for all users by setting the
|
You can enforce a specific authentication method for all users by setting the
|
||||||
`enforcedAuthType` in the system-level `settings.json` file. This prevents users
|
`security.auth.enforcedType` in the system-level `settings.json` file. This
|
||||||
from choosing a different authentication method. See the
|
prevents users from choosing a different authentication method. See the
|
||||||
[Authentication docs](../get-started/authentication.md) for more details.
|
[Authentication docs](../get-started/authentication.md) for more details.
|
||||||
|
|
||||||
**Example:** Enforce the use of Google login for all users.
|
**Example:** Enforce the use of Google login for all users.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"enforcedAuthType": "oauth-personal"
|
"security": {
|
||||||
|
"auth": {
|
||||||
|
"enforcedType": "oauth-personal"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ describe('validateNonInterActiveAuth', () => {
|
|||||||
expect(processExitSpy).not.toHaveBeenCalled();
|
expect(processExitSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('succeeds if effectiveAuthType matches enforcedAuthType', async () => {
|
it('succeeds if effectiveAuthType matches enforcedType', async () => {
|
||||||
mockSettings.merged.security.auth.enforcedType = AuthType.USE_GEMINI;
|
mockSettings.merged.security.auth.enforcedType = AuthType.USE_GEMINI;
|
||||||
process.env['GEMINI_API_KEY'] = 'fake-key';
|
process.env['GEMINI_API_KEY'] = 'fake-key';
|
||||||
const nonInteractiveConfig = createLocalMockConfig({});
|
const nonInteractiveConfig = createLocalMockConfig({});
|
||||||
@@ -308,7 +308,7 @@ describe('validateNonInterActiveAuth', () => {
|
|||||||
expect(debugLoggerErrorSpy).not.toHaveBeenCalled();
|
expect(debugLoggerErrorSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('exits if configuredAuthType does not match enforcedAuthType', async () => {
|
it('exits if configuredAuthType does not match enforcedType', async () => {
|
||||||
mockSettings.merged.security.auth.enforcedType = AuthType.LOGIN_WITH_GOOGLE;
|
mockSettings.merged.security.auth.enforcedType = AuthType.LOGIN_WITH_GOOGLE;
|
||||||
const nonInteractiveConfig = createLocalMockConfig({
|
const nonInteractiveConfig = createLocalMockConfig({
|
||||||
getOutputFormat: vi.fn().mockReturnValue(OutputFormat.TEXT),
|
getOutputFormat: vi.fn().mockReturnValue(OutputFormat.TEXT),
|
||||||
@@ -334,7 +334,7 @@ describe('validateNonInterActiveAuth', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('exits if auth from env var does not match enforcedAuthType', async () => {
|
it('exits if auth from env var does not match enforcedType', async () => {
|
||||||
mockSettings.merged.security.auth.enforcedType = AuthType.LOGIN_WITH_GOOGLE;
|
mockSettings.merged.security.auth.enforcedType = AuthType.LOGIN_WITH_GOOGLE;
|
||||||
process.env['GEMINI_API_KEY'] = 'fake-key';
|
process.env['GEMINI_API_KEY'] = 'fake-key';
|
||||||
const nonInteractiveConfig = createLocalMockConfig({
|
const nonInteractiveConfig = createLocalMockConfig({
|
||||||
|
|||||||
Reference in New Issue
Block a user