Class SessionCredentials

java.lang.Object
ai.redouble.demo.spring.SessionCredentials
All Implemented Interfaces:
SessionStore

@Component public class SessionCredentials extends Object implements SessionStore
Credentials a person pastes into the page, held for this process only. They land as a runtime MapPropertySource placed ahead of every other source, so the runtime's Boot-property store (SpringSecrets, reading nucleo.credentials.<id>) sees them through the same machinery a vault or an environment variable uses - the runtime neither knows nor cares that the value arrived from a form. Nothing here is ever written to a file, echoed back over HTTP, or logged beyond the credential's id; stopping the process is the only place these values live.

A credential the deployment already holds is refused rather than shadowed: the app's clients are constructed once around a credential and shared, so replacing one mid-process would leave live clients on the old value and new ones on the new - a lie on the status page. Session credentials fill gaps, they never override the deployment's. A credential this store itself holds may be corrected - a mistyped endpoint must not need a restart - and the caller evicts the affected providers' cached clients in the same breath.

Since:
0.1 (2026-09-18)
Author:
Andrey Santrosyan
  • Constructor Summary

    Constructors
    Constructor
    Description
    SessionCredentials(org.springframework.core.env.ConfigurableEnvironment environment)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether this store holds any part of the credential - a session credential may be corrected, a deployment's never.
    void
    provide(String id, String user, String secret, String host)
    Holds one credential for the rest of this process: the id is the runtime's record name (anthropic-api-key, aws-region); user, secret and host are its parts, blank parts left unset.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SessionCredentials

      public SessionCredentials(org.springframework.core.env.ConfigurableEnvironment environment)
  • Method Details

    • provide

      public void provide(String id, String user, String secret, String host)
      Holds one credential for the rest of this process: the id is the runtime's record name (anthropic-api-key, aws-region); user, secret and host are its parts, blank parts left unset. Effective from the next lookup - the property source is live.
      Specified by:
      provide in interface SessionStore
    • holds

      public boolean holds(String id)
      Whether this store holds any part of the credential - a session credential may be corrected, a deployment's never.
      Specified by:
      holds in interface SessionStore