Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions ee/psso/Bridge/SysdBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public struct AKInteractiveAuth {
public var DTH: String
}

public enum SocketID {
case defaultSocket
case ctrlSocket
}

public class SysdBridge {

public static let shared: SysdBridge = SysdBridge()
Expand All @@ -51,9 +56,9 @@ public class SysdBridge {
self.logInterceptor = LogInterceptor(logger: self.logger)
}

func getSocketPath(id: String) -> String {
func getSocketPath(id: SocketID) -> String {
#if os(macOS)
if id == "default" {
if id == .defaultSocket {
return "/var/run/authentik-sysd.sock"
} else {
return "/var/run/authentik-sysd-\(id).sock"
Expand All @@ -64,7 +69,7 @@ public class SysdBridge {
}

func withClient<Result: Sendable>(
id: String = "default",
id: SocketID = .defaultSocket,
handleClient: (GRPCClient<HTTP2ClientTransport.Posix>) async throws -> Result
) async throws -> Result {
return try await withGRPCClient(
Expand Down Expand Up @@ -116,7 +121,7 @@ public class SysdBridge {
}

public func interactiveAuthSupported() async throws -> Bool {
return try await self.withClient { client in
return try await self.withClient(id: .ctrlSocket) { client in
let c = SystemCtrl.Client(wrapping: client)
let reply = try await c.capabilities(
request: ClientRequest(message: Google_Protobuf_Empty())
Expand All @@ -137,7 +142,7 @@ public class SysdBridge {
}

public func domainsEnroll(name: String, authentikURL: String, token: String) async throws {
return try await self.withClient(id: "ctrl") { client in
return try await self.withClient(id: .ctrlSocket) { client in
let c = SystemCtrl.Client(wrapping: client)
let _ = try await c.domainEnroll(
request: ClientRequest(
Expand All @@ -151,7 +156,7 @@ public class SysdBridge {
}

public func domainsList(name: String, authentikURL: String, token: String) async throws {
return try await self.withClient(id: "ctrl") { client in
return try await self.withClient(id: .ctrlSocket) { client in
let c = SystemCtrl.Client(wrapping: client)
let reply = try await c.domainList(
request: ClientRequest(message: Google_Protobuf_Empty())
Expand Down
1 change: 1 addition & 0 deletions vpkg/macos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package:
ln -s "ak" "${TOP}/bin/${TARGET}/${MACOS_APP_NAME}/Contents/MacOS/ak-vault" || true
chmod +x "${TOP}/bin/${TARGET}/${MACOS_APP_NAME}/Contents/MacOS/"*
cp -R "${TOP}/bin/psso/PSSO.appex" "${TOP}/bin/${TARGET}/${MACOS_APP_NAME}/Contents/PlugIns/PSSO.appex"
chmod +x "${TOP}/bin/${TARGET}/${MACOS_APP_NAME}/Contents/PlugIns/PSSO.appex/Contents/MacOS/"*
codesign \
--force \
--verify \
Expand Down
Loading