55 Commits

Author SHA1 Message Date
a9e56b131c Removes one-time sanity log
All checks were successful
Build, Push and Run Container / build (push) Successful in 30s
Removes the temporary logging middleware used for verifying forwarded headers. This was a one-time check and is no longer needed.
2025-10-15 19:51:16 +02:00
ecb4482a1b Configures forwarded headers options
All checks were successful
Build, Push and Run Container / build (push) Successful in 32s
Configures the forwarded headers options to accept all forwarded headers,
clears the default known networks and proxies, and adds a new known IP network
to allow any IP address. This is necessary to handle requests from proxies
and load balancers correctly.
2025-10-15 19:48:58 +02:00
86c000f323 Reverse proxy mess
All checks were successful
Build, Push and Run Container / build (push) Successful in 29s
2025-10-15 19:43:32 +02:00
84dc22f324 Add forwarded headers
All checks were successful
Build, Push and Run Container / build (push) Successful in 29s
2025-10-15 19:32:23 +02:00
6ac6d05f5f Simplifies authentication logic and adds VIN.
All checks were successful
Build, Push and Run Container / build (push) Successful in 35s
Removes temporary test endpoints and refactors the authorize endpoint.

Adds support for VIN notifications for a new vehicle by adding it to the dictionary.
2025-10-15 19:13:50 +02:00
387ef9e70a Redirects to Tesla authorization on missing token
All checks were successful
Build, Push and Run Container / build (push) Successful in 53s
The application now redirects to the Tesla authorization endpoint when the access token is missing.
This ensures the user is prompted to authorize the application.
2025-09-19 13:28:39 +02:00
22df381755 Enables location and gear testing via API
All checks were successful
Build, Push and Run Container / build (push) Successful in 27s
Adds query parameters for latitude and longitude to the `/TestStartParking` endpoint, allowing to simulate different locations.

Adds logic to set the gear to "P" if the received value is null to cover edge cases.

Ensures asynchronous message processing by awaiting the result of ProcessMessage to prevent potential race conditions.
2025-08-25 08:49:57 +02:00
b00cebbd0a Add test cases
All checks were successful
Build, Push and Run Container / build (push) Successful in 27s
2025-08-21 17:23:52 +02:00
00e79097d6 Fixes telemetry config endpoint call
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Removes redundant verb from the telemetry config endpoint URI, ensuring the request is correctly routed.
2025-08-21 15:15:27 +02:00
c62dc22245 Plain text instead of JSON
All checks were successful
Build, Push and Run Container / build (push) Successful in 26s
2025-08-21 15:13:18 +02:00
85cf55f878 Check config
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-21 15:11:30 +02:00
6c59133e13 Status endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
2025-08-21 15:06:18 +02:00
d2e976aee1 Adds VIN to RePair telemetry config request
All checks were successful
Build, Push and Run Container / build (push) Successful in 29s
Ensures the RePair endpoint includes the VIN in the telemetry config request.
This guarantees that telemetry data is specifically requested for the provided VIN.
2025-08-21 14:59:51 +02:00
576b3b91a4 Updates access token for RePair endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
Updates the hardcoded access token used in the /RePair endpoint.

The previous token was likely outdated or invalid, preventing the endpoint from functioning correctly. This change ensures the endpoint can properly authenticate and access necessary resources.
2025-08-21 14:56:31 +02:00
0549406720 Specifies ILogger type for RePair endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Specifies ILogger type for the RePair endpoint,
ensuring the correct logger context is used for configuration-related logging.
2025-08-21 14:55:14 +02:00
1de73e0bca Uses dependency injection for logger/client
All checks were successful
Build, Push and Run Container / build (push) Successful in 27s
Specifies that the logger and http client factory should be injected via dependency injection instead of directly from the request.

This allows for better testability and separation of concerns.
2025-08-21 14:54:05 +02:00
430daa39dc Configures fleet telemetry via API
All checks were successful
Build, Push and Run Container / build (push) Successful in 26s
Implements fleet telemetry configuration by first removing the existing telemetry configuration and then posting a new configuration.

This configures telemetry data collection intervals and host information.

Adds logging for request/response from the API.
2025-08-21 14:52:03 +02:00
4cfad4ae33 Add diagnose endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 29s
2025-08-21 14:32:06 +02:00
317b3eeacd Zone determinator service wired
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
2025-08-20 12:03:10 +02:00
05c102aee8 Add KeyPairing to /Tesla endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-18 22:07:10 +02:00
5daf0825a0 Adds fleet status endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Adds an endpoint to retrieve fleet status information.

This endpoint uses a Tesla API proxy to fetch the fleet status
based on provided VINs. It handles authentication using a bearer
token and sends a POST request to the /api/1/vehicles/fleet_status
endpoint.

Also introduces new data models to properly serialize/deserialize the fleet status response.
2025-08-18 21:47:06 +02:00
d291e6ec3e Removes redundant client configuration
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Removes the redundant base address and header configurations from within the endpoint handler. This configuration should be handled elsewhere, avoiding unnecessary repetition.
2025-08-18 12:34:07 +02:00
f06dd72213 Updates application registration endpoints
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Changes the application registration endpoints to use the ITeslaAuthenticatorService interface.

Updates the KeyPairing endpoint to redirect to the correct Tesla connector app.
Adds a new KeyPairing2 endpoint.
2025-08-18 12:28:05 +02:00
947a1313c8 Move no cars found so logs can be read
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-17 12:29:12 +02:00
f724e59f7f Configures telemetry using external file
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Reads telemetry configuration parameters such as hostname, port, and CA certificate from an external JSON file.
This decouples configuration from code, allowing for easier updates and management of telemetry settings.
2025-08-17 12:27:32 +02:00
701b578b71 Removes redundant content-type header
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Removes the explicit setting of the "Content-Type" header,
as HttpClient handles this automatically based on the content being sent.

This change simplifies the code and avoids potential conflicts
if the content type is already being set elsewhere.
2025-08-17 12:18:38 +02:00
0ac37d198c Configures insecure HTTP client for proxy
All checks were successful
Build, Push and Run Container / build (push) Successful in 26s
Adds named HTTP client configuration with insecure settings to
communicate with the tesla_command_proxy, which uses a self-signed
certificate.

Changes the base address to use HTTPS.
2025-08-17 12:17:01 +02:00
3663595f78 Updates redirect URI for authorization
All checks were successful
Build, Push and Run Container / build (push) Successful in 26s
Changes the redirect URI after successful authorization to a more specific endpoint, likely to integrate with a UI or service named "Tesla". This allows the application to properly handle the authorization response and proceed with the next steps.
2025-08-17 12:12:40 +02:00
04a708216a Uses local redirect for authorization.
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Changes from `RedirectToRoute` to `LocalRedirect` for the
authorization endpoint to improve security and ensure the
redirect stays within the application's domain.
2025-08-17 12:11:27 +02:00
f049d023c9 Adds Tesla API integration
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Adds an endpoint to interact with the Tesla API via a command proxy.

This includes fetching vehicle information and configuring telemetry settings. It introduces new models to represent the Tesla API responses and request structures.
2025-08-17 12:03:26 +02:00
663bb4b019 Return
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-17 00:39:46 +02:00
c05678b619 Set issuer
All checks were successful
Build, Push and Run Container / build (push) Successful in 21s
2025-08-17 00:37:23 +02:00
5dbaf01a99 Fix the fix
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-17 00:18:39 +02:00
944256940f Fix
Some checks failed
Build, Push and Run Container / build (push) Failing after 17s
2025-08-17 00:16:16 +02:00
02725b0596 Add validissuer
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
2025-08-16 23:53:01 +02:00
20b11cff71 Manual config
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-16 23:50:09 +02:00
890162394d Configures Tesla OIDC endpoints dynamically
All checks were successful
Build, Push and Run Container / build (push) Successful in 23s
Configures the Tesla OIDC endpoints using the base URL
to dynamically set authorization, token, JWKS URI, end
session, and user info endpoints. This eliminates the need
for a URL override function and centralizes the endpoint
configuration logic.
2025-08-16 23:37:14 +02:00
a192f1380b Configures OIDC with explicit endpoints
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
Configures the OpenID Connect (OIDC) authentication flow by
explicitly setting the authorization, token, JWKS, end session, and
user info endpoints.

This change removes the custom OIDC configuration manager and
directly sets the configuration within the OIDC options. This approach
simplifies the configuration and ensures that the application uses
the correct endpoints for authentication and authorization with the
third-party provider.
2025-08-16 23:31:35 +02:00
96dd0ff99a Configures Fleet-Auth OIDC authentication
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
Updates the authentication configuration to utilize Fleet-Auth's third-party OIDC configuration.

This change streamlines the authentication process by directly pointing to the third-party metadata and adds the Fleet API audience to the token request, ensuring proper authorization for accessing Tesla's Fleet API. It also configures Tesla specific parameters.
2025-08-16 23:13:00 +02:00
31bbc1a99d Better debug
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
2025-08-16 23:01:01 +02:00
df60b4cda5 Enhances Tesla OIDC authentication
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Improves authentication by adding a signing key resolver and overriding the token endpoint.

This change ensures proper validation of Tesla's OIDC tokens by fetching the signing keys from the issuer's `certs` endpoint and caching them. It also configures the token endpoint required for Tesla authentication.
2025-08-16 22:54:56 +02:00
b6cd5e404e Disables issuer validation
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Disables issuer validation during token authentication.

The token validation parameters are adjusted to bypass
issuer validation, since the issuer is already validated via the `ValidIssuers` parameter.
2025-08-16 22:36:35 +02:00
6aa7221ed5 Adds valid issuers for Tesla authentication
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
Adds multiple valid issuers to the authentication configuration.
This ensures compatibility with different Tesla authentication endpoints,
including fleet and regional variations.
2025-08-16 22:30:22 +02:00
cab671193e Enhances request header logging.
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
Adds detailed logging of request headers for debugging purposes.

Clears known networks and proxies in forwarded headers options.

This change improves the ability to diagnose issues related to
request handling and forwarding in different environments.
2025-08-16 22:24:47 +02:00
e392f5a7b8 Configures forwarded headers for the application
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Ensures the application correctly handles forwarded headers
by explicitly setting the `ForwardedHeaders` option to `ForwardedHeaders.All`.

This allows the application to properly determine the client's
IP address and other request information when behind a proxy
or load balancer.
2025-08-16 22:14:35 +02:00
0af7c38a6b Adds ForwardedHeaders and debug endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Adds ForwardedHeaders to handle reverse proxy scenarios.

Adds a debug endpoint to display the correct scheme and host
when running behind a reverse proxy, aiding in debugging
authentication issues.
2025-08-16 22:12:14 +02:00
9755e516d9 Updates callback path for authentication
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Updates the callback path for authentication to a relative path.

This change removes the hardcoded domain from the callback URL,
making the application more flexible and easier to deploy in
different environments.
2025-08-16 22:05:44 +02:00
d3eb1bb66c Updates docker config and adds HttpContext
All checks were successful
Build, Push and Run Container / build (push) Successful in 23s
Removes a redundant host config in the docker file.

Adds HttpContextAccessor to the service collection. This
component is used to provide access to the current request context.
2025-08-16 22:04:10 +02:00
31f823b51f Configures Tesla OpenID Connect authentication
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
Implements authentication against the Tesla Fleet API using OpenID Connect.

Uses a custom OIDC configuration manager to override the token endpoint.
Configures authentication services and adds required scopes and parameters.
Adds endpoints for application registration and token retrieval during development.
2025-08-16 22:01:32 +02:00
a7ea7ff632 Add authorization and key-pairing
All checks were successful
Build, Push and Run Container / build (push) Successful in 30s
2025-08-16 20:40:27 +02:00