authConnect attempts to authenticate the user using the given context. If authentication succeeds an authenticated IPC connection to the Seesaw Engine is returned.
(ctx *ipc.Context)
| 62 | // authentication succeeds an authenticated IPC connection to the Seesaw |
| 63 | // Engine is returned. |
| 64 | func (e *ECU) authConnect(ctx *ipc.Context) (*conn.Seesaw, error) { |
| 65 | if ctx == nil { |
| 66 | return nil, errors.New("context is nil") |
| 67 | } |
| 68 | authCtx, err := e.cfg.Authenticator.Authenticate(ctx) |
| 69 | if err != nil { |
| 70 | return nil, fmt.Errorf("authentication failed: %v", err) |
| 71 | } |
| 72 | |
| 73 | seesawConn, err := conn.NewSeesawIPC(authCtx) |
| 74 | if err != nil { |
| 75 | return nil, fmt.Errorf("failed to connect to engine: %v", err) |
| 76 | } |
| 77 | if err := seesawConn.Dial(e.cfg.EngineSocket); err != nil { |
| 78 | return nil, fmt.Errorf("failed to connect to engine: %v", err) |
| 79 | } |
| 80 | |
| 81 | return seesawConn, nil |
| 82 | } |
no test coverage detected