- Add support for the OAuth Device Authorization Flow (RFC 8628) in the OpenAPI service, allowing devices with limited input capabilities to obtain authorization. - Implement `DeviceAuthorization()` and `AuthorizeDevice()` methods to handle device and user code generation, storage, and authorization. - Update the OAuth endpoints to include `/device/authorize` for user code authorization and fix the discovery endpoint path for device authorization. - Introduce MongoDB service in CI workflows for testing and enhance the unit test workflow with Redis setup. - Update Go module dependencies to include necessary packages for the new features. This commit significantly advances the OAuth capabilities of the application, enabling a more flexible authorization process for devices.
24 lines
477 B
Go
24 lines
477 B
Go
//go:build darwin
|
|
|
|
package engine
|
|
|
|
import (
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
func platformMachineID() (string, error) {
|
|
out, err := exec.Command("ioreg", "-rd1", "-c", "IOPlatformExpertDevice").Output()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
for _, line := range strings.Split(string(out), "\n") {
|
|
if strings.Contains(line, "IOPlatformUUID") {
|
|
parts := strings.SplitN(line, `"`, 4)
|
|
if len(parts) >= 4 {
|
|
return strings.TrimSpace(parts[3]), nil
|
|
}
|
|
}
|
|
}
|
|
return "", nil
|
|
}
|