Repository navigation
Description
Summary
The Third Party module cannot complete Spring context initialization against the current dev-mysql profile. A narrow chain of bean-wiring gaps surfaces when bringing TP up locally against a fresh DC + AS pair (in support of #122 PR C4 manual testing). The deeper architectural issue is that TP is not currently a functional ESPI third party — its OAuth2 client config, Atom marshalling pipeline, and Notification Endpoint receiver path have not been brought to a working state in the Spring Boot 4 / Spring 7 migration.
Priority context: Per the project lead, DC API completion is upstream of this work. TP cannot meaningfully exercise the OAuth2 + ESPI resource flow without a complete DC API surface (the BatchList notifications, the Subscription resource feeds, the Customer/PII resource feeds, etc. that TP would receive). File a focused DC API audit/completion issue first; this TP issue should be triaged after DC stabilizes.
What's already been observed locally
Encountered in this order while running mvn spring-boot:run -Dspring-boot.run.profiles=dev-mysql:
-
Missing
UsagePointMapperbean — TP's@SpringBootApplication.scanBasePackagesexcludedorg.greenbuttonalliance.espi.common.mapper, so MapStruct-generated mapper impls were not registered. Half-fix in PR Phase 2.0 — Stand up auth-server in dev with opaque tokens + subscription-bound introspection (Phase 2 precursor) #122 PR C4 (broadened scan toorg.greenbuttonalliance.espi.common). -
Missing
EspiIdGeneratorServicebean — same root cause; lives inorg.greenbuttonalliance.espi.common.service(not.service.impl). Resolved by the same scan broadening in PR C4. -
Missing
Jaxb2Marshallerbean namedatomMarshaller—ResourceRESTRepositoryImpl(and several other resource repos)@Autowireda@Qualifier("atomMarshaller")Jaxb2Marshaller. No@Beandefinition currently exists for it in TP, openespi-common, or any autoconfiguration on the classpath. PR C4 does NOT fix this — manual testing stops here.
What likely remains under the surface
The pattern above (TP discovering missing collaborator beans one-at-a-time during context init) suggests the migration from the pre-Spring-Boot-4 codebase left TP partially wired. Likely items to audit:
- Atom feed marshalling pipeline —
Jaxb2Marshaller+ ESPI/Atom JAXB context configuration, currently undefined. - Notification Endpoint — TP's REST endpoint that receives
BatchListfrom DC at grant-completion. Status: unverified, likely also missing security + Jaxb plumbing. - OAuth2 client config — TP's
application.ymlreferencesclient-id: third_partyand callback URIs; needs end-to-end verification against AS's currentRegisteredClientdefinition (AuthorizationServerConfig.java:278-301). - Resource fetching layer —
ResourceRESTRepositoryImpl,UsagePointRESTRepositoryImpl, etc.; whether they actually round-trip against DC's current Atom feed endpoints. - JPA layer — TP has 24 repository interfaces; need to confirm the entity scan and database schema (TP currently runs with
flyway: 0 migrationsagainst athirdpartyMySQL DB, suggesting either it's relying on Hibernateddl-auto=updateor it doesn't actually persist anything that matters yet).
Reproduction (current state)
# Per PR C4 README instructions
cd openespi-thirdparty
mvn spring-boot:run -Dspring-boot.run.profiles=dev-mysqlFails with:
APPLICATION FAILED TO START
Field marshaller in org.greenbuttonalliance.espi.thirdparty.repository.impl.ResourceRESTRepositoryImpl
required a bean of type 'org.springframework.oxm.jaxb.Jaxb2Marshaller' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- @org.springframework.beans.factory.annotation.Qualifier("atomMarshaller")
Recommended approach (after DC API work lands)
- Audit the full TP bean dependency graph at context-init time — identify every
@Autowiredcollaborator from TP code into openespi-common and confirm each has a definition path. Don't fix one-at-a-time; produce a list, then plan. - Define the missing
atomMarshallerJaxb2Marshallerbean — likely belongs in either openespi-common's Spring config or a new TP@Configurationclass. Aligns with whatever JAXB context the existingBaseExportServicefamily uses on DC. - End-to-end smoke the OAuth2 customer flow: TP root → AS
/oauth2/authorize→ DC consent screen → token exchange → TP fetches a UsagePoint feed. (Blocked on the DC API completion above.) - Notification Endpoint smoke test — DC pushes a BatchList to TP at grant-completion; TP processes and persists. (Likely also blocked on DC.)
- Remove PR Phase 2.0 — Stand up auth-server in dev with opaque tokens + subscription-bound introspection (Phase 2 precursor) #122 PR C4's TP scan-broadening workaround once the proper wiring is in place — or keep it as the canonical wide-scan pattern if that matches the project's preference.
Out of scope for this issue
- DC API completion + missing endpoints — upstream of this work, needs its own focused issue and probably its own multi-PR effort.
- The PR C4 work itself (Phase 2.0 — Stand up auth-server in dev with opaque tokens + subscription-bound introspection (Phase 2 precursor) #122) — already shipped, ships its workaround for the two minimal bean-wiring gaps so AS can be tested manually.
- Issue Complete #123 schema-repair sync: align AS V1 schema with application code column names #145 (AS schema-repair sync) — independent of TP.
Acceptance
- Document the architectural intent for TP (is it a reference OAuth2 client for ESPI integrators? a development harness for DC API testing? something else?).
-
mvn spring-boot:run -Dspring-boot.run.profiles=dev-mysqlboots TP cleanly against a working DC + AS. - Browser flow: TP root → OAuth2 authorize → DC screens → token exchange → TP can fetch and render at least one ESPI resource.
- DC-to-TP Notification Endpoint receives and processes a BatchList push.
- PR Phase 2.0 — Stand up auth-server in dev with opaque tokens + subscription-bound introspection (Phase 2 precursor) #122 PR C4's TP scan-broadening workaround is either confirmed correct and kept, or replaced with the project's preferred pattern.
Activity
feat(#122 PR C4): AS-side back-channel call + token-response augmenta…
feat(#158): DC→TP notification contract + TP-receiver stub (#163)
dfcoffin commentedon Jun 7, 2026
Bring-up findings (manual AS+DC+TP launch, 2026-06-06)
Confirmed the TP context-init wiring chain by launching all three servers locally (MySQL on 3306). Progress on the chain:
atomMarshallerJaxb2Marshallerbean — defined in PR fix: local sandbox bring-up — DC↔AS introspection alignment + TP atomMarshaller (#146) #170 (JaxbMarshallingConfiguration). TP now advances past this gap.ResourceRepository—ResourceRESTServiceImpl.resourceRepositoryrequiresorg.greenbuttonalliance.espi.common.repositories.usage.ResourceRepository, which is a custom interface with NO implementation anywhere (noResourceRepositoryImpl, noimplements ResourceRepository). The resource-fetch layer was never built. This is the substantive next step for TP bring-up.ResourceRepositorymethods likefindAllIdsByXPath). Per "DC API completion is upstream of TP," these stay deferred.Also note (not TP): the DC↔AS dev introspection config was misaligned (DC→:8080 / unseeded
datacustodianclient) — fixed in #170 so the sandbox introspects out of the box. And DC collection GETs marshal a rawList(500) — fixed by the #119 E-phase entry/feed assembly.Runbook for local 3-server bring-up captured in the working notes.
fix: local sandbox bring-up — DC↔AS introspection alignment + TP atom…
feat(#177): TP BatchList receiver does authenticated GET-and-import; …
feat(#177): admin compose & send ESPI BatchList notification (DC send…
fix(#146): make the Third Party application boot (remove dead Resourc…
feat(#177): admin compose & send ESPI BatchList notification (DC send…
dfcoffin commentedon Nov 14, 2026
Update from a local run, 2026-11-14 (
localH2 profile)Progress: the Third Party now starts with
-Dspring-boot.run.profiles=localin about 5.7 s on port 8082, and theatomMarshallerstart-up failure described above no longer happens./,/homeand/loginrender. The navigation-link problems are filed separately as #235.OAuth client configuration vs. the AS's seeded
third_partyclient. This is the "needs end-to-end verification" item above, now checked:application.yml(datacustodian-monthly/-daily/-admin)third_party(AuthorizationServerConfig)${OAUTH2_CLIENT_SECRET:secret}{noop}tp-secretinvalid_clienthttp://localhost:8082/ThirdParty/login/oauth2/code/<registrationId>…:8080/DataCustodian/oauth/callback,…:9090/ThirdParty/oauth/callback/oauth2/authorizereturns 400openid,profile,FB=…openid/profileregistered, but OIDC is restricted since #134invalid_scope: OpenID Connect 1.0 authentication requests are restricted.datacustodian-adminThirdParty_Admin_Accessviaauthorization_codeclient_credentialsWith the AS's own redirect URI and only the ESPI FB scope,
/oauth2/authorizegets as far as the DC delegation step, then stops because of the new blocking issue #232.Suggested fixes:
openid,profilefrom the TP scopes.…:8082/ThirdParty/login/oauth2/code/*, or make both sides configurable from one set of properties.datacustodian-admintoclient_credentials.dfcoffin commentedon Nov 16, 2026
TP sign-in is lost when a customer authorizes a Data Custodian (found in the #268 review)
Since #268 (#249), the Third Party has its own form login: a customer signs in with a TP account (
ROLE_USER), then authorizes a Data Custodian from the home page cards. DC authorization still runs throughoauth2Login, and that is now a defect.What happens
customersigns in with form login and hasROLE_USER./oauth2/authorize/monthly→/oauth2/authorization/datacustodian-monthly) and approve at the DC./login/oauth2/code/datacustodian-monthlyis handled byOAuth2LoginAuthenticationFilter. It replaces the session's authentication with anOAuth2AuthenticationToken, whose principal is the DC user (user-name-attribute: uuid) and whose authorities areOAUTH2_USERandSCOPE_*.ROLE_USER. feat(thirdparty): username/password login matching the Data Custodian design (#249) #268 also turned on@EnableMethodSecurity, so customer pages with@PreAuthorize("hasRole('ROLE_USER')")(UsagePointController,DataCustodianListController) now return 403.oauth2Loginalso calls theuser-info-uri. That points at a DC ESPI resource and is not OIDC user info. If the call fails, the login fails and the token is not kept.Also:
oauth2Loginsigns in visitors who have no TP account (found in the #270 review).OAuth2AuthorizationRequestRedirectFilterandOAuth2LoginAuthenticationFilterrun before the authorization rules. So an anonymous visitor can open/oauth2/authorization/datacustodian-monthlydirectly, approve at the Data Custodian, and return signed in to the Third Party as the OAuth2 principal, without a TP account and without the TP login page. They can then open every page that requires onlyauthenticated()(anyRequest().authenticated()inSecurityConfiguration). Role-gated pages stay closed, because the token carries onlyOAUTH2_USER/SCOPE_*. This was already true before #268, whenoauth2Loginwas the only sign-in. Moving tooauth2Client()removes it:OAuth2AuthorizationCodeGrantFilternever authenticates anyone, and the authorization endpoints can then require a signed-in TP customer.Proposed fix: use
.oauth2Client()instead of.oauth2Login()for thedatacustodian-*registrations.OAuth2AuthorizationCodeGrantFiltercompletes the authorization-code grant and stores the authorized client for the current (form-login) principal without changing it, and it doesn't call user info. The callback redirect URIs and the AS seed's registered redirect URIs need to match whatever callback path is chosen. Link the stored Authorization and Subscription to the TPRetailCustomerEntity(AuthorizationEntity.retailCustomer), as the decision comment on #249 describes.Related, from the same review
datacustodian-admin, which is aclient_credentialsregistration (Local manual-test kit: aligned AS/DC/TP local profiles, start/stop/smoke scripts, and docs/LOCAL_TESTING.md #254). The authorization-code redirect behind that button can't work. The ESPI client access token should be obtained withclient_credentialsin the background, not from a customer-facing card./?authorization_error) instead of the login page's "Invalid username or password". Withoauth2Client, that error handling would move to the authorization-code grant filter.fix(thirdparty): address the #275 review of the oauth2Client token st…
fix(thirdparty): address the second #275 review of the oauth2Client f…
feat(thirdparty): Spring Security oauth2Client for the Data Custodian…