Class OAuthAuthorizationServer

java.lang.Object
com.revetsec.oauth.server.OAuthAuthorizationServer

@ThreadSafe public final class OAuthAuthorizationServer extends Object
Caller-thread OAuth code issuer with authoritative online grant status. Applications supply users, consent, atomic durable storage, admitted store time, healthy worker clocks, keys and authorization policy. Register the exact configured routes; request headers never select issuer authority. Protect completion with the app's session and CSRF controls. Infrastructure faults remain exceptions; expected remote rejection is a restricted result. Construction performs no application data callbacks, network I/O, signing or thread startup; the builder documents its explicit observer notification. No positive grant-status cache. Revetsec has not been independently audited.
Since:
1.0.0
  • Method Details

    • withIssuer

      @CheckReturnValue public static @NonNull OAuthAuthorizationServer.Builder withIssuer(@NonNull String issuer)
      Starts configuration with an exact issuer identity, retained for the lifetime of the builder/server. The primary argument is required and cannot be cleared. This factory checks its URI shape; numeric HTTP loopback is admitted provisionally but still requires OAuthAuthorizationServer.Builder.allowInsecureLoopback(Boolean) at build. Localhost HTTP issuers are not supported. No endpoint routes are inferred or network calls made.
      Parameters:
      issuer - absolute HTTPS issuer, or a numeric HTTP loopback issuer for explicit local opt-in
      Returns:
      an otherwise unconfigured builder
      Throws:
      NullPointerException - if issuer is null
      IllegalArgumentException - if issuer is not a permitted absolute issuer URI
      Since:
      1.0.0
    • beginAuthorizationResult

      @CheckReturnValue public @NonNull OAuthAuthorizationResult beginAuthorizationResult(@NonNull String httpMethod, @Nullable String rawQuery, byte @NonNull [] rawBody, @NonNull Map<@NonNull String, @NonNull List<@NonNull String>> rawHeaderValues, @NonNull BrowserBinding browserBinding)
      Admits a GET authorization request and creates a browser-bound interaction.
      Parameters:
      httpMethod - materialized method
      rawQuery - original query or absence
      rawBody - materialized body
      rawHeaderValues - original header names and all occurrences
      browserBinding - independent app-owned canonical random binding
      Returns:
      interaction or fixed local rejection
      Since:
      1.0.0
    • resumeAuthorizationResult

      @CheckReturnValue public @NonNull OAuthAuthorizationResult resumeAuthorizationResult(@NonNull String interactionValue, @NonNull BrowserBinding browserBinding)
      Rechecks a continuation before rendering consent; this does not authenticate a user.
      Parameters:
      interactionValue - secret continuation
      browserBinding - independent app-owned binding
      Returns:
      checked restricted interaction or rejection
      Since:
      1.0.0
    • completeAuthorizationResult

      Completes app-protected consent once, with a fresh narrowing policy check before commit.
      Parameters:
      interactionValue - secret continuation
      browserBinding - independent app-owned binding
      decision - trusted server-side app decision
      Returns:
      retained committed redirect or rejection
      Since:
      1.0.0
    • tokenResult

      @CheckReturnValue public @NonNull OAuthTokenResult tokenResult(@NonNull String httpMethod, @Nullable String rawQuery, byte @NonNull [] rawBody, @NonNull Map<@NonNull String, @NonNull List<@NonNull String>> rawHeaderValues)
      Handles one bounded token form request on its configured route.
      Parameters:
      httpMethod - materialized method
      rawQuery - original query or absence
      rawBody - materialized body
      rawHeaderValues - original names and every occurrence
      Returns:
      committed response or fixed local rejection
      Since:
      1.0.0
    • revokeResult

      @CheckReturnValue public @NonNull OAuthRevocationResult revokeResult(@NonNull String httpMethod, @Nullable String rawQuery, byte @NonNull [] rawBody, @NonNull Map<@NonNull String, @NonNull List<@NonNull String>> rawHeaderValues)
      Handles one bounded revocation form request on its configured route.
      Parameters:
      httpMethod - materialized method
      rawQuery - original query or absence
      rawBody - materialized body
      rawHeaderValues - original names and every occurrence
      Returns:
      committed response or fixed local rejection
      Since:
      1.0.0
    • introspectionResult

      @CheckReturnValue public @NonNull OAuthIntrospectionResult introspectionResult(@NonNull String httpMethod, @Nullable String rawQuery, byte @NonNull [] rawBody, @NonNull Map<@NonNull String, @NonNull List<@NonNull String>> rawHeaderValues)
      Handles one bounded introspection form request on its configured route.
      Parameters:
      httpMethod - materialized method
      rawQuery - original query or absence
      rawBody - materialized body
      rawHeaderValues - original names and every occurrence
      Returns:
      committed response or fixed local rejection
      Since:
      1.0.0
    • validateAccessTokenResult

      Validates local M5 signature/profile facts and uncached authoritative issuer status before releasing the checked token and its sensitive issuer-local grant management handle. The handle is constructed from the same access/grant snapshot only after the atomic status barrier commits; it is not a generic JWT claim.
      Parameters:
      token - unverified bearer credential
      resource - exact configured application resource
      Returns:
      restricted checked proof plus grant handle, or fixed rejection
      Since:
      1.0.0
    • revokeGrant

      public void revokeGrant(@NonNull String grantValue)
      Revokes a trusted grant reference monotonically.
      Parameters:
      grantValue - trusted management identity
      Since:
      1.0.0
    • revokeSubject

      public void revokeSubject(@NonNull String subject)
      Advances an established subject fence; UNKNOWN requires reconciliation.
      Parameters:
      subject - trusted management identity
      Since:
      1.0.0
    • revokeAllGrants

      public void revokeAllGrants()
      Advances the established issuer fence; UNKNOWN requires reconciliation.
      Since:
      1.0.0
    • establishNewSubject

      public void establishNewSubject(@NonNull String subject)
      Explicitly registers a never-used subject; never use this to repair lost permanent fences.
      Parameters:
      subject - trusted management identity
      Since:
      1.0.0
    • initializeFreshIssuer

      Explicitly initializes a namespace the operator knows has never been used or restored. Existing state yields CONFLICT. UNKNOWN never means ready; reconcile before traffic or retry.
      Returns:
      one authoritative initialization outcome
      Since:
      1.0.0
    • resealStoreEntry

      Attempts one authenticated reseal CAS without changing grant authority or retention.
      Parameters:
      key - privileged namespace-bound maintenance key
      Returns:
      the factual store outcome: COMMITTED, CONFLICT for absence/race/expired row, UNKNOWN requiring reconciliation, or another explicit refusal reported by the configured store
      Since:
      1.0.0
    • metadataResponse

      @CheckReturnValue public @NonNull OAuthServerResponse metadataResponse(@NonNull String httpMethod)
      Prepares bounded public metadata for GET or HEAD.
      Parameters:
      httpMethod - exact method
      Returns:
      safe public response, including method rejection
      Throws:
      OAuthServerConfigurationException - if the configured representation exceeds publication capacity
      Since:
      1.0.0
    • jwksResponse

      @CheckReturnValue public @NonNull OAuthServerResponse jwksResponse(@NonNull String httpMethod)
      Prepares bounded public json web key set for GET or HEAD.
      Parameters:
      httpMethod - exact method
      Returns:
      safe public response, including method rejection
      Throws:
      OAuthServerConfigurationException - if the configured representation exceeds publication capacity
      Since:
      1.0.0
    • responseForFailure

      Translates a caught infrastructure exception to a fixed, bounded local503 response.
      Parameters:
      failure - restricted issuer failure
      Returns:
      safe response with no redirect or reflected descriptions
      Since:
      1.0.0
    • warmUp

      public void warmUp()
      Checks configured signing keys and the established issuer fence on one shrinking caller budget. Never initializes missing state or fetches arbitrary client metadata.
      Since:
      1.0.0
    • getIssuer

      @CheckReturnValue public @NonNull String getIssuer()
      Returns configured Issuer.
      Returns:
      exact setting or optional absence
      Since:
      1.0.0
    • getAuthorizationEndpoint

      @CheckReturnValue public @NonNull URI getAuthorizationEndpoint()
      Returns configured AuthorizationEndpoint.
      Returns:
      exact setting or optional absence
      Since:
      1.0.0
    • getTokenEndpoint

      @CheckReturnValue public @NonNull URI getTokenEndpoint()
      Returns configured TokenEndpoint.
      Returns:
      exact setting or optional absence
      Since:
      1.0.0
    • getJwksEndpoint

      @CheckReturnValue public @NonNull URI getJwksEndpoint()
      Returns configured JwksEndpoint.
      Returns:
      exact setting or optional absence
      Since:
      1.0.0
    • getRevocationEndpoint

      @CheckReturnValue public @NonNull Optional<@NonNull URI> getRevocationEndpoint()
      Returns configured RevocationEndpoint.
      Returns:
      exact setting or optional absence
      Since:
      1.0.0
    • getIntrospectionEndpoint

      @CheckReturnValue public @NonNull Optional<@NonNull URI> getIntrospectionEndpoint()
      Returns configured IntrospectionEndpoint.
      Returns:
      exact setting or optional absence
      Since:
      1.0.0
    • toString

      Returns a fixed description without configuration or credentials.
      Overrides:
      toString in class Object
      Returns:
      redacted description
      Since:
      1.0.0