-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cactus-plugin-ledger-connector-cdl-socketio): support subscripti…
…on key auth - Add alternative auth method using subscriptionKey instead of accessToken. - Both auth methods are supported but can't be used at the same time. - Adjust manual test script to work with subscriptionKey. - Build manual script as part of the main build. - Update README. - Remove default `api/v1/` URL prefix for compatibility with https://en-portal.research.global.fujitsu.com/ Signed-off-by: Michal Bajer <[email protected]>
- Loading branch information
Showing
6 changed files
with
187 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...es/cactus-plugin-ledger-connector-cdl-socketio/src/main/typescript/connector/type-defs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { type } from "os"; | ||
|
||
export type SupportedFunctions = | ||
| "registerHistoryData" | ||
| "getLineage" | ||
| "searchByHeader" | ||
| "searchByGlobalData" | ||
| "status"; | ||
|
||
export type AuthInfoAccessTokenArgsType = { | ||
accessToken: string; | ||
trustAgentId: string; | ||
}; | ||
|
||
export type AuthInfoSubscriptionKeyArgsType = { | ||
subscriptionKey: string; | ||
trustAgentId: string; | ||
trustAgentRole: string; | ||
trustUserId: string; | ||
trustUserRole: string; | ||
}; | ||
|
||
export type AuthInfoArgsType = | ||
| AuthInfoAccessTokenArgsType | ||
| AuthInfoSubscriptionKeyArgsType; | ||
|
||
export function isAuthInfoAccessTokenArgsType( | ||
authInfo: AuthInfoArgsType, | ||
): authInfo is AuthInfoAccessTokenArgsType { | ||
const typedAuthInfo = authInfo as AuthInfoAccessTokenArgsType; | ||
return ( | ||
typedAuthInfo && | ||
typeof typedAuthInfo.accessToken !== "undefined" && | ||
typeof typedAuthInfo.trustAgentId !== "undefined" | ||
); | ||
} | ||
|
||
export function isAuthInfoSubscriptionKeyArgsType( | ||
authInfo: AuthInfoArgsType, | ||
): authInfo is AuthInfoSubscriptionKeyArgsType { | ||
const typedAuthInfo = authInfo as AuthInfoSubscriptionKeyArgsType; | ||
return ( | ||
typedAuthInfo && | ||
typeof typedAuthInfo.subscriptionKey !== "undefined" && | ||
typeof typedAuthInfo.trustAgentId !== "undefined" && | ||
typeof typedAuthInfo.trustAgentRole !== "undefined" && | ||
typeof typedAuthInfo.trustUserId !== "undefined" && | ||
typeof typedAuthInfo.trustUserRole !== "undefined" | ||
); | ||
} | ||
|
||
export type FunctionArgsType = { | ||
method: { | ||
type: SupportedFunctions; | ||
authInfo: AuthInfoArgsType; | ||
}; | ||
args: any; | ||
reqID?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters