-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial cecAuth changes * name fixes * Adding support or Action Execute Auth * taking off callback from CEC APIs * fixing default value for external-app-auth input * cec name updated to cea * adding documentation for new CEA APIs * changing .then logic to async/await * changing incoming response from hubsdk * moving interfaces to their original place * telemetry fix + testing * change file * e2e test for isSupported * matching string for e2e test * addressig review feedback * adding documenation * using sendAndUnwrap call instead of sendMessageToParentAsync
- Loading branch information
Showing
12 changed files
with
1,171 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
apps/teams-test-app/e2e-test-data/externalAppAuthenticationForCEA.json
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,16 @@ | ||
{ | ||
"name": "ExternalAppAuthenticationForCEA", | ||
"version": ">2.29.0", | ||
"hostSdkVersion": { | ||
"web": ">=4.3.0" | ||
}, | ||
"platform": "Web", | ||
"testCases": [ | ||
{ | ||
"title": "checkExternalAppAuthenticationForCEACapability API Call - Success", | ||
"type": "callResponse", | ||
"boxSelector": "#box_checkExternalAppAuthenticationForCEACapability", | ||
"expectedTestAppValue": "External App Authentication For CEA module is supported" | ||
} | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
apps/teams-test-app/e2e-test-data/externalAppCardActionsForCEA.json
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
219 changes: 219 additions & 0 deletions
219
apps/teams-test-app/src/components/privateApis/ExternalAppAuthenticationForCEAAPIs.tsx
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,219 @@ | ||
import { AppId, externalAppAuthentication, externalAppAuthenticationForCEA } from '@microsoft/teams-js'; | ||
import React from 'react'; | ||
|
||
import { ApiWithoutInput } from '../utils/ApiWithoutInput'; | ||
import { ApiWithTextInput } from '../utils/ApiWithTextInput'; | ||
import { ModuleWrapper } from '../utils/ModuleWrapper'; | ||
|
||
const CheckExternalAppAuthenticationForCEACapability = (): React.ReactElement => | ||
ApiWithoutInput({ | ||
name: 'checkExternalAppAuthenticationForCEACapability', | ||
title: 'Check External App Authentication CEA Capability', | ||
onClick: async () => | ||
`External App Authentication For CEA module ${externalAppAuthenticationForCEA.isSupported() ? 'is' : 'is not'} supported`, | ||
}); | ||
|
||
const AuthenticateWithOAuthForCEA = (): React.ReactElement => | ||
ApiWithTextInput<{ | ||
appId: string; | ||
conversationId: string; | ||
authenticateParameters: { | ||
url: string; | ||
width?: number; | ||
height?: number; | ||
isExternal?: boolean; | ||
}; | ||
}>({ | ||
name: 'AuthenticateWithOAuthForCEA', | ||
title: 'Authenticate With OAuth', | ||
onClick: { | ||
validateInput: (input) => { | ||
if (!input.appId) { | ||
throw new Error('appId is required'); | ||
} | ||
if (!input.conversationId) { | ||
throw new Error('conversationId is required'); | ||
} | ||
if (!input.authenticateParameters) { | ||
throw new Error('authenticateParameters is required'); | ||
} | ||
}, | ||
submit: async (input) => { | ||
await externalAppAuthenticationForCEA.authenticateWithOauth(new AppId(input.appId), input.conversationId, { | ||
...input.authenticateParameters, | ||
url: new URL(input.authenticateParameters.url), | ||
}); | ||
return 'Completed'; | ||
}, | ||
}, | ||
defaultInput: JSON.stringify({ | ||
appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a', | ||
conversationId: 'testConversationId', | ||
authenticateParameters: { | ||
url: 'https://localhost:4000', | ||
width: 100, | ||
height: 100, | ||
isExternal: true, | ||
}, | ||
}), | ||
}); | ||
|
||
const AuthenticateWithSSOForCEA = (): React.ReactElement => | ||
ApiWithTextInput<{ | ||
appId: string; | ||
conversationId: string; | ||
authTokenRequest: externalAppAuthentication.AuthTokenRequestParameters; | ||
}>({ | ||
name: 'authenticateWithSSOForCEA', | ||
title: 'Authenticate With SSO', | ||
onClick: { | ||
validateInput: (input) => { | ||
if (!input.appId) { | ||
throw new Error('appId is required'); | ||
} | ||
if (!input.conversationId) { | ||
throw new Error('conversationId is required'); | ||
} | ||
if (!input.authTokenRequest) { | ||
throw new Error('authTokenRequest is required'); | ||
} | ||
}, | ||
submit: async (input) => { | ||
await externalAppAuthenticationForCEA.authenticateWithSSO( | ||
new AppId(input.appId), | ||
input.conversationId, | ||
input.authTokenRequest, | ||
); | ||
|
||
return 'Completed'; | ||
}, | ||
}, | ||
defaultInput: JSON.stringify({ | ||
appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a', | ||
conversationId: 'testConversationId', | ||
authTokenRequest: { | ||
claims: ['https://graph.microsoft.com'], | ||
silent: true, | ||
}, | ||
}), | ||
}); | ||
|
||
const AuthenticateAndResendRequestForCEA = (): React.ReactElement => | ||
ApiWithTextInput<{ | ||
appId: string; | ||
conversationId: string; | ||
authenticateParameters: { | ||
url: string; | ||
width?: number; | ||
height?: number; | ||
isExternal?: boolean; | ||
}; | ||
originalRequestInfo: externalAppAuthentication.IActionExecuteInvokeRequest; | ||
}>({ | ||
name: 'authenticateAndResendRequestForCEA', | ||
title: 'Authenticate And Resend Request', | ||
onClick: { | ||
validateInput: (input) => { | ||
if (!input.appId) { | ||
throw new Error('appId is required'); | ||
} | ||
if (!input.conversationId) { | ||
throw new Error('conversationId is required'); | ||
} | ||
if (!input.authenticateParameters) { | ||
throw new Error('authenticateParameters is required'); | ||
} | ||
if (!input.originalRequestInfo) { | ||
throw new Error('originalRequestInfo is required'); | ||
} | ||
}, | ||
submit: async (input) => { | ||
const result = await externalAppAuthenticationForCEA.authenticateAndResendRequest( | ||
new AppId(input.appId), | ||
input.conversationId, | ||
{ ...input.authenticateParameters, url: new URL(input.authenticateParameters.url) }, | ||
input.originalRequestInfo, | ||
); | ||
return JSON.stringify(result); | ||
}, | ||
}, | ||
defaultInput: JSON.stringify({ | ||
appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a', | ||
conversationId: 'testConversationId', | ||
authenticateParameters: { | ||
url: 'https://localhost:4000', | ||
width: 100, | ||
height: 100, | ||
isExternal: true, | ||
}, | ||
originalRequestInfo: { | ||
requestType: 'ActionExecuteInvokeRequest', | ||
type: 'Action.Execute', | ||
id: 'id1', | ||
verb: 'verb1', | ||
data: 'data1', | ||
}, | ||
}), | ||
}); | ||
const AuthenticateWithSSOAndResendRequestForCEA = (): React.ReactElement => | ||
ApiWithTextInput<{ | ||
appId: string; | ||
conversationId: string; | ||
authTokenRequest: externalAppAuthentication.AuthTokenRequestParameters; | ||
originalRequestInfo: externalAppAuthentication.IActionExecuteInvokeRequest; | ||
}>({ | ||
name: 'authenticateWithSSOAndResendRequestForCEA', | ||
title: 'Authenticate With SSO And Resend Request', | ||
onClick: { | ||
validateInput: (input) => { | ||
if (!input.appId) { | ||
throw new Error('appId is required'); | ||
} | ||
if (!input.conversationId) { | ||
throw new Error('conversationId is required'); | ||
} | ||
if (!input.authTokenRequest) { | ||
throw new Error('authTokenRequest is required'); | ||
} | ||
if (!input.originalRequestInfo) { | ||
throw new Error('originalRequestInfo is required'); | ||
} | ||
}, | ||
submit: async (input) => { | ||
const result = await externalAppAuthenticationForCEA.authenticateWithSSOAndResendRequest( | ||
new AppId(input.appId), | ||
input.conversationId, | ||
input.authTokenRequest, | ||
input.originalRequestInfo, | ||
); | ||
return JSON.stringify(result); | ||
}, | ||
}, | ||
defaultInput: JSON.stringify({ | ||
appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a', | ||
conversationId: 'testConversationId', | ||
authTokenRequest: { | ||
claims: ['https://graph.microsoft.com'], | ||
silent: true, | ||
}, | ||
originalRequestInfo: { | ||
requestType: 'ActionExecuteInvokeRequest', | ||
type: 'Action.Execute', | ||
id: 'id1', | ||
verb: 'verb1', | ||
data: 'data1', | ||
}, | ||
}), | ||
}); | ||
|
||
const ExternalAppAuthenticationForCEAAPIs = (): React.ReactElement => ( | ||
<ModuleWrapper title="External App Authentication for CEA"> | ||
<CheckExternalAppAuthenticationForCEACapability /> | ||
<AuthenticateWithOAuthForCEA /> | ||
<AuthenticateWithSSOForCEA /> | ||
<AuthenticateAndResendRequestForCEA /> | ||
<AuthenticateWithSSOAndResendRequestForCEA /> | ||
</ModuleWrapper> | ||
); | ||
|
||
export default ExternalAppAuthenticationForCEAAPIs; |
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
7 changes: 7 additions & 0 deletions
7
change/@microsoft-teams-js-cee144c2-e3b9-40a5-bb3e-05608280d179.json
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,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Added support for `ExternalAppAuthenticationForCEA` capability", | ||
"packageName": "@microsoft/teams-js", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
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
Oops, something went wrong.