ワンクリックで
a2a-workflow
Use when working with SafeguardJava application-to-application credential retrieval, brokering, or A2A events.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when working with SafeguardJava application-to-application credential retrieval, brokering, or A2A events.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when making standard Safeguard REST API calls through SafeguardJava connections.
Use when modifying Azure Pipelines, build templates, signing configuration, Maven Central publishing, GitHub Packages publishing, or release process. Covers GPG signing, JAR code signing, version strategy, and critical pipeline pitfalls.
Use when working on SDK internals, authentication flows, connection classes, event listeners, A2A contexts, SPS integration, or adding new authentication methods. Covers the rSTS token exchange, strategy pattern, and SignalR event system.
Use when running tests, writing tests, investigating test failures, or setting up a test environment against a live Safeguard appliance. Covers the PowerShell test framework, CLI test tool, test suites, module-to-suite mapping, and writing new suites.
| name | a2a-workflow |
| description | Use when working with SafeguardJava application-to-application credential retrieval, brokering, or A2A events. |
Safeguard Application-to-Application (A2A) is the SDK path for non-interactive
automation that needs privileged credentials without a user login prompt. In
SafeguardJava, A2A is certificate-authenticated, API-key-scoped, and exposed
through Safeguard.A2A.getContext(...) plus ISafeguardA2AContext. Use it for
service accounts, scheduled jobs, brokers, and other integrations that need to
retrieve or rotate credentials directly from Safeguard.
The main A2A surface is com.oneidentity.safeguard.safeguardjava.ISafeguardA2AContext.
SafeguardA2AContext maintains two internal REST clients:
https://<appliance>/service/a2a/v<apiVersion>https://<appliance>/service/core/v<apiVersion>The A2A client is used for credential retrieval and brokering (Credentials,
AccessRequests), while the core client is used to enumerate A2ARegistrations
and their RetrievableAccounts.
Important design constraints from the SDK:
Authorization: A2A <apiKey> headerService.A2A is not valid with ISafeguardConnectionchar[] in the public interfacesdispose()The repository samples document the expected appliance-side setup:
Samples/CertificateConnect/README.md calls out uploading the root/intermediate CA chainSamples/A2ARetrievalExample/README.md calls out configuring retrieval registrationschar[]getContext(...) overloadSafeguard.A2A.getContext(...) supports the same certificate sources the rest of the SDK uses:
apiVersionignoreSsl or a custom HostnameVerifierExamples from the actual factories in Safeguard.java:
ISafeguardA2AContext fromFile = Safeguard.A2A.getContext(
appliance,
certificatePath,
certificatePassword,
null,
true);
ISafeguardA2AContext fromKeystore = Safeguard.A2A.getContext(
appliance,
keystorePath,
keystorePassword,
certificateAlias,
null,
true);
Windows thumbprint overloads require SunMSCAPI to be available. The SDK throws a
SafeguardForJavaException on non-Windows platforms or when the provider is missing.
ISafeguardA2AContext.getRetrievableAccounts() first queries Core/A2ARegistrations,
then enumerates each registration's RetrievableAccounts endpoint. The returned
IA2ARetrievableAccount objects include application name, asset/account details,
and the API key as char[].
List<IA2ARetrievableAccount> accounts = a2aContext.getRetrievableAccounts();
for (IA2ARetrievableAccount account : accounts) {
System.out.println(account.getAssetName() + " -> " + account.getAccountName());
}
There is also a filtered form:
List<IA2ARetrievableAccount> accounts =
a2aContext.getRetrievableAccounts("AccountName eq 'admin'");
The filter is passed server-side as the filter query parameter on each registration lookup.
This is the path shown in Samples/A2ARetrievalExample/.../A2ARetrievalExample.java:
char[] password = a2aContext.retrievePassword(apiKey);
try {
usePassword(password);
} finally {
java.util.Arrays.fill(password, '\0');
}
Internally, the SDK sends:
GET Credentialstype=PasswordAuthorization: A2A <apiKey>The setter method name is capitalized in this SDK:
a2aContext.SetPassword(apiKey, newPassword);
That becomes PUT Credentials/Password with a JSON string body.
char[] privateKey = a2aContext.retrievePrivateKey(apiKey, KeyFormat.OpenSsh);
a2aContext.SetPrivateKey(apiKey, privateKey, passphrase, KeyFormat.OpenSsh);
The getter uses GET Credentials?type=PrivateKey&keyFormat=<format>.
The setter uses PUT Credentials/SshKey with a serialized SshKey payload.
List<IApiKeySecret> secrets = a2aContext.retrieveApiKeySecret(apiKey);
This uses GET Credentials?type=ApiKey and maps the response into ApiKeySecret
objects with clientId, clientSecret, and related metadata.
SafeguardJava supports brokering through:
IBrokeredAccessRequestBrokeredAccessRequestBrokeredAccessRequestTypeISafeguardA2AContext.brokerAccessRequest(...)The test harness in tests/safeguardjavaclient/.../SafeguardTests.java builds a
BrokeredAccessRequest, sets AccountId, AssetId, ForUserId, and an access type,
then calls brokerAccessRequest(...).
Minimal pattern:
IBrokeredAccessRequest request = new BrokeredAccessRequest();
request.setForUserId(forUserId);
request.setAssetId(assetId);
request.setAccountId(accountId);
request.setAccessType(BrokeredAccessRequestType.Password);
request.setReasonComment("Created by service broker");
String result = a2aContext.brokerAccessRequest(apiKey, request);
What the SDK enforces before sending POST AccessRequests:
ForUserId or ForUserName must be setAssetId or AssetName must be setapiKey and accessRequest cannot be nullapiVersionBrokeredAccessRequest also exposes optional fields for emergency access, reason
codes, ticket numbers, RequestedFor, and day/hour/minute duration values.
A2A supports SignalR listeners through the same ISafeguardEventListener interface used
for standard Safeguard events.
From ISafeguardA2AContext:
getA2AEventListener(char[] apiKey, ISafeguardEventHandler handler)getA2AEventListener(List<char[]> apiKeys, ISafeguardEventHandler handler)getPersistentA2AEventListener(char[] apiKey, ISafeguardEventHandler handler)getPersistentA2AEventListener(List<char[]> apiKeys, ISafeguardEventHandler handler)SafeguardA2AContext automatically registers these event names on the listener:
AssetAccountPasswordUpdatedAssetAccountSshKeyUpdatedAccountApiKeySecretUpdatedBasic usage:
ISafeguardEventHandler handler = (eventName, eventBody) -> {
System.out.println(eventName);
System.out.println(eventBody);
};
ISafeguardEventListener listener =
a2aContext.getPersistentA2AEventListener(apiKey, handler);
listener.start();
If you do not want to build the context yourself, Safeguard.A2A.Event exposes many
getPersistentA2AEventListener(...) overloads that accept certificate file, keystore,
thumbprint, or in-memory certificate inputs directly.
PersistentSafeguardA2AEventListener extends PersistentSafeguardEventListenerBase.
When the internal SignalR listener disconnects, the base class:
This is the right choice for long-running services.
Non-persistent listeners do not recover from long outages. The interface documentation calls out the 30+ second outage case explicitly.
Common failures are visible directly in the public methods:
ObjectDisposedException if you call the context after dispose()ArgumentException for null apiKey, null password/private-key arguments, or an empty API key listSafeguardForJavaException("Unable to connect to web service ...") when the HTTP client returns nullSafeguardForJavaException("Error returned from Safeguard API, Error: <status> <body>") for non-2xx responsesSafeguardForJavaException("You must specify a user...") or ("You must specify an asset...") during brokeringSafeguardForJavaException("Error parsing JSON response") or serialization failures when payload conversion breaksSafeguardForJavaException("Missing SunMSCAPI provider...") for Windows thumbprint usage without the providerSafeguardForJavaException("Not implemented. This function is only available on the Windows platform.") for thumbprint overloads on non-Windows hostsTroubleshooting checklist:
getRetrievableAccounts() to prove what the certificate can actually seeignoreSsl=true outside lab scenarios