-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support OIDC login
- Loading branch information
Showing
3 changed files
with
142 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
Juju Admin version 4. | ||
This facade is available on: | ||
Controller-machine-agent | ||
Machine-agent | ||
Unit-agent | ||
Controllers | ||
Models | ||
*/ | ||
|
||
import type { JujuRequest } from "../../generator/interfaces.js"; | ||
import { ConnectionInfo, Transport } from "../client.js"; | ||
import AdminV3, { LoginResult } from "../facades/admin/AdminV3.js"; | ||
|
||
/** | ||
admin is the only object that unlogged-in clients can access. It holds any | ||
methods that are needed to log in. | ||
*/ | ||
class AdminV4 extends AdminV3 { | ||
static NAME = "Admin"; | ||
static VERSION = 4; | ||
|
||
NAME = "Admin"; | ||
VERSION = 4; | ||
|
||
constructor(transport: Transport, info: ConnectionInfo) { | ||
super(transport, info); | ||
} | ||
/** | ||
LoginWithSessionCookie logs in if the session cookie exists when the | ||
websocket connection is made. All subsequent requests on the | ||
connection will act as the authenticated user. | ||
*/ | ||
loginWithSessionCookie(): Promise<LoginResult> { | ||
return new Promise((resolve, reject) => { | ||
const req: JujuRequest = { | ||
type: "Admin", | ||
request: "LoginWithSessionCookie", | ||
version: 4, | ||
}; | ||
|
||
this._transport.write(req, resolve, reject); | ||
}); | ||
} | ||
} | ||
|
||
export default AdminV4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters