OpenAM /json/authenticate ReST api behaves differently on different servers - openam

I am calling the OpenAM /json/authenticate api for a realm. The request details are as below. The issue is on one server the response received contains the tokenId directly and on other it gives the authId with callbacks. Both servers are exactly same with same configuration. Any help in fixing the output to get the tokenId directly would be a great help. There is limited help available on OpenAM. This has given me a couple of sleepless nights.
Method: POST
URL: http://localhost:8080/openam/json/authenticate?realm=/MYREALM
Headers:
1. Content-Type:application/json
2. X-OpenAM-Password:Wsdwe#9900
3. X-OpenAM-Username:sdf.er#dummy.com
Output on one server
{
"tokenId": "AQIC5wM2LY4SfcwB_yB8SZ5JOfJSzlbBCIb0645ky5NrwUY.*AAJTSQACMDMAAlNLADASMjExOTAwMjczNDI5Mjg0Mjc3MgACUzEAAjAy*",
"successUrl": "/openam/console"
}
Output on other server
{
"authId": "eyAidHlwIjogIkpXVCIsGHJhbGciOiAiSFMyNTYiIH0.eyAib3RrIjogImo1Y2gybnFqaGwybGhnZ250cWIzazNkMHFpIiwgInJlYWxtIjogIm89aXRzdXBwb3J0MjQ3ZGF0YXN0b3JlLG91PXNlcnZpY2VzLGRjPW9wZW5hbSxkYz1mb3JnAWEvY2ssZGM9b3JnIiwgInNlc3Npb25JZCI6ICJBUUlDNXdNMkxZNFNmY3h0UUDSFGlielFPYkJuUVUxTTNudUlab3JFdEcxX2liNC4qQUFKVFNRQUNNREVBQWxOTEFCTTRPRGcxTkRRME16STFNRFl3TXpnNE5EUTRBQUpUTVFBQSoiIH0.rWE7A_tjcsyiXpQdAXUsS6OiHi97HhXQEkYwY919ovE",
"template": "",
"stage": "IDMDataStore1",
"header": "Access Your Account",
"callbacks": [
{
"type": "NameCallback",
"output": [
{
"name": "prompt",
"value": "Email ID:"
}
],
"input": [
{
"name": "IDToken1",
"value": "sdf.er#dummy.com"
}
]
},
{
"type": "PasswordCallback",
"output": [
{
"name": "prompt",
"value": "Password:"
}
],
"input": [
{
"name": "IDToken2",
"value": ""
}
]
},
{
"type": "TextOutputCallback",
"output": [
{
"name": "message",
"value": "\n "
},
{
"name": "messageType",
"value": "0"
}
]
}
]
}
NOTE: I am using OpenAM 13.0.0

Related

Multiple authorization using swagger OpenAPI 3.0 with Express and JSON format

The project has two authorization systems, basic auth and bearer. I need for each request after clicking on the "try it out" and "execute" buttons to attach to the request the Authorization headers, in which there will be a Basic line and a jwt header, in which there will be a bearer token. The problem is that I can attach these headers individually, but not together. There is a feeling that both authorizations want to write to the Authorization header and one of them overwrites the other, even though I explicitly indicated the header names in the schema.
My schemas:
{
"securitySchemes": {
"Bearer": {
"in": "header",
"name": "jwt",
"type": "http",
"scheme": "bearer"
},
"basicAuth": {
"type": "http",
"scheme": "basic"
}
}
}
and how I use it:
{
"/channel/base-list": {
"get": {
"tags": [
"CMS Channel"
],
"security": [
{
"Bearer": [],
"basicAuth": []
}
],
"summary": "Get _id and title of all channels",
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "count",
"required": false,
"schema": {
"type": "Integer"
},
"default": 25,
"example": 10
},
{
"in": "query",
"name": "search",
"required": false,
"schema": {
"type": "String"
},
"description": "Channel name"
}
],
"responses": {
"200": {
"description": "A list of channels",
"content": {
"application/json": {
"schema": {
"$ref": "#/definitions/get-channel-base-list"
}
}
}
}
}
}
}
}
I use swagger-ui-express for node.JS and OpenAPI 3.0
A request can contain only one Authorization header, and the Authorization header can only contain a single set of credentials (i.e. either Basic or Bearer, but not both). Your use case is not supported by the HTTP protocol.

Alexa CBT Test: Failed Test due to DeepQuery=True

My colleagues and I have been working to fix a reported issue on our Amazon Alexa CBT Test regarding the value “DeepQuery=true”.
Our code has been modified, so that every state change is reported automatically and all the used interfaces have the properties “proactivelyReported” and “retrievable” set to true.
As has been suggested by the WWA-Support we used the Smart Home Debugger of the Developer Console to validate the ReportEvents (e.g. Discovery or ChangeReport) and we checked the state of our device on the “View Device State” page (both pages are referenced on: https://developer.amazon.com/en-US/docs/alexa/smarthome/debug-your-smart-home-skill.html).
For debugging purposes we scaled our device capabilities down to just the PowerController. The AddOrUpdateReport of Alexa.Discovery looks to our eyes now exactly as expected/documented. Same goes for the ChangeReport, which we proactively send right after the AddOrUpdateReport (Two sample-Reports for both are provided at the end).
Unfortunately we are still faced with the issue, that “DeepQuery=true” on the “View Device State” page.
If we set the interface property “retrievable” to false, “DeepQuery=false”, but the Alexa-App does not retain the current state of the device. In this configuration the Alexa-App can only be used to send commands, which unfortunately will lead to other test cases to fail.
Does anyone know how to solve this issue?
How can we set “proactivelyReported” and “retrievable” to true and have “DeepQuery=false”?
Any help would be greatly appreciated and I will gladly provide more informations if needed.
Sample AddOrUpdateReport from Smart Home Debugger
{
"header": {
"namespace": "SkillDebugger",
"name": "CaptureDebuggingInfo",
"messageId": "05b030fb-6393-4ae0-80d0-47fc27876f0e"
},
"payload": {
"skillId": "amzn1.ask.skill.055ca62d-3cf8-4f51-a683-9a98b36f4637",
"timestamp": "2021-09-09T13:28:21.629Z",
"dialogRequestId": null,
"skillRequestId": null,
"type": "SmartHomeAddOrUpdateReportSuccess",
"content": {
"addOrUpdateReport": {
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "AddOrUpdateReport",
"messageId": "2458b969-7c3e-47e2-ab0b-6e13a999be76",
"payloadVersion": "3"
},
"payload": {
"endpoints": [
{
"manufacturerName": "Our Company Name",
"description": "Our Product Name",
"endpointId": "device--cb12b420-1171-11ec-81f3-cb34e87ea438",
"friendlyName": "Lampe 1",
"capabilities": [
{
"type": "AlexaInterface",
"version": "3",
"interface": "Alexa.PowerController",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
}
],
"displayCategories": [
"LIGHT"
],
"connections": [],
"relationships": {},
"cookie": {}
}
],
"scope": null
}
}
}
}
}
}
Sample ChangeReport from Smart Home Debugger
{
"header": {
"namespace": "SkillDebugger",
"name": "CaptureDebuggingInfo",
"messageId": "194a96a1-6747-46ba-8751-5c9ef715fd34"
},
"payload": {
"skillId": "amzn1.ask.skill.055ca62d-3cf8-4f51-a683-9a98b36f4637",
"timestamp": "2021-09-09T13:28:23.227Z",
"dialogRequestId": null,
"skillRequestId": null,
"type": "SmartHomeChangeReportSuccess",
"content": {
"changeReport": {
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "8972e386-9622-40e6-85e7-1a7d81c79c8a",
"payloadVersion": "3"
},
"endpoint": {
"scope": null,
"endpointId": "device--cb12b420-1171-11ec-81f3-cb34e87ea438"
},
"payload": {
"change": {
"cause": {
"type": "APP_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "ON",
"timeOfSample": "2021-09-09T13:28:18.088Z",
"uncertaintyInMilliseconds": 500
}
]
}
}
},
"context": {
"properties": []
}
}
}
}
}

Issue with Microsoft chat bot giving double responses to a question instead of just 1 time that i have instructed it to do

I am currently using micro soft's speech studio to create a simple chat bot. For all my questions, I need to add a confirmation rule to ask if they need further assistance getting to the location they are looking for. However after it gets to the last part of the speech command it keeps saying the speech 2 times instead of just that once. For example, for this question on where chambers b is for example, it will say the speech response twice instead of just that once that it used to output just 2 days back.
the example sentences page
this is my confirmation command in the speech studio to ask whether they need assistance getting to the location
this is my successful command assuming the user says yes during the confirmation stage
However the issue came about just yesterday when I was testing the chatbot. I got this output during testing: "Sure, please follow me now" twice instead of just once that I needed.
this is what came up during the testing phase. As you can see it said sure please follow me now 2 times instead of just that 1 time that I needed
Thanks for reaching out.
The configuration in the screenshots look OK.
I created a confirmation example to verify the behavior and I was not able to reproduce this with the windows client (same you used in your screenshots).
Here is the sample app you can import to try it out.
{
"entityResolver": {
"searchConfiguration": {
"maxEdits": 0
},
"type": "internal",
"isGenerated": true
},
"minIntentConfidence": 0.4,
"highIntentConfidence": 0.8,
"lgTemplates": [
"# FallbackResponse",
"- Add your fallback message here",
"# TestCommand-MyNumber",
"- what number?",
"# TestCommand-27dfe650040311ebb2dccf4459b3ff8b",
"- confirmed.",
"# TestCommand-3228f4d0040311ebb2dccf4459b3ff8b",
"- denied.",
"# TestCommand-4ea19f40040311ebb2dccf4459b3ff8b",
"- sure?"
],
"type": "BaseLanguage",
"recognizer": {
"application": "",
"isStaging": false,
"versionId": "0.1",
"type": "luis"
},
"speechOutput": {
"font": "Microsoft Server Speech Text to Speech Voice (en-US, Aria24kRUS)",
"locale": "en-US"
},
"webEndpoints": [],
"globalParameters": [],
"commands": [
{
"name": "FallbackCommand",
"completionStrategy": "OnRequiredParameters",
"parameters": [],
"rules": [],
"completionRules": [
{
"name": "DefaultResponse",
"conditions": [
{
"type": "True"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# FallbackResponse"
}
}
],
"postExecutionState": "None"
}
],
"triggeringExamples": [
"> - You can start sentences with '>' to add comments.",
"> - You can also use parameters by adding the name of the parameter within curly braces, i.e.",
"> Set an alarm to {YourDateParameterName}",
"> Where YourDateParameterName is the name of a parameter defined in the 'Parameters' section.",
"Help",
"Help me",
"What can you do?",
"How can I start?",
"Hello",
"Hi"
],
"multiTurnExamples": []
},
{
"name": "TestCommand",
"completionStrategy": "OnRequiredParameters",
"parameters": [
{
"name": "MyNumber",
"type": {
"name": "Number"
},
"elicitResponse": {
"type": "Template",
"templateName": "# TestCommand-MyNumber"
}
}
],
"rules": [
{
"name": "Confirm command",
"conditions": [
{
"type": "AllRequiredParameters"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# TestCommand-4ea19f40040311ebb2dccf4459b3ff8b"
}
}
],
"nextTurnExpectations": [
{
"type": "Confirmation"
}
],
"postExecutionState": "WaitForInput"
},
{
"name": "Confirmation succeeded",
"conditions": [
{
"type": "SuccessfulConfirmation"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# TestCommand-27dfe650040311ebb2dccf4459b3ff8b"
}
}
],
"nextTurnExpectations": [],
"postExecutionState": "ReadyForCompletion"
},
{
"name": "Confirmation denied",
"conditions": [
{
"type": "DeniedConfirmation"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# TestCommand-3228f4d0040311ebb2dccf4459b3ff8b"
}
}
],
"nextTurnExpectations": [],
"postExecutionState": "CompleteCommand"
}
],
"completionRules": [
{
"name": "Done",
"conditions": [
{
"type": "True"
}
],
"actions": [],
"nextTurnExpectations": [],
"postExecutionState": "CompleteCommand"
}
],
"triggeringExamples": [
"number {MyNumber}",
"my number is {MyNumber}"
]
}
]
}
And here is a sample output with the windows client.
Sample output
Hope this help! o.w. If you could clone your application and provide a stripped-down version with the failure and we'll be happy to help you troubleshoot further.

How to send to Amazon's Alexa Event Gateway?

I am trying to test sending an event to the Amazon's Event Gateway for my Alexa Smart Home skill using Postman but I keep receiving an 'invalid access token exception.' I have read the Amazon's documentation on this but apparently I am missing something.
When I enable my skill, my Smart Home Lambda receives the AcceptGrant.
{
"directive": {
"header": {
"namespace": "Alexa.Authorization",
"name": "AcceptGrant",
"messageId": "b2862179-bc56-4bb2-ac05-ce55c7a3e977",
"payloadVersion": "3"
},
"payload": {
"grant": {
"type": "OAuth2.AuthorizationCode",
"code": "ANSVjPzpTDBsdfoRSyrs"
},
"grantee": {
"type": "BearerToken",
"token": "Atza|IwEB..."
}
}
}
}
My lambda sends a POST to 'https://api.amazon.com/auth/o2/token' to receive the Access and Refresh tokens. It then stores those tokens. Next, my Lamdba responds with the following:
{
"event": {
"header": {
"namespace": "Alexa.Authorization",
"name": "AcceptGrant.Response",
"messageId": "b2862179-bc56-4bb2-ac05-ce55c7a3e977",
"payloadVersion": "3"
},
"payload": {}
}
}
I then get a message web page that I have successfully linked my skill - all is good.
Next, I try to send an event to Amazon's Alexa event gateway using the Postman app. I put the Access token (I also tried the Refresh token) in the header as a 'BearerToken' type and the in the 'scope' of the 'endpoint' object.
POST https://api.amazonalexa.com/v3/events?Content-Type=application/json&charset=UTF-8
with a header that specifies a Bearer Token (Access token received earlier) and a body that contains the following:
{
"event": {
"header": {
"messageId": "abc-123-def-456",
"namespace": "Alexa",
"name": "ChangeReport",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<access token>"
},
"endpointId": "MySmartSwitch-001"
},
"payload": {
"change": {
"cause": {
"type": "RULE_TRIGGER"
},
"properties": [
{
"namespace": "Alexa.ModeController",
"name": "mode",
"value": "Backup",
"timeOfSample": "2020-01-02T09:30:00ZZ",
"uncertaintyInMilliseconds": 50
}
]
}
}
},
"context": {
"properties": [
{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "ON",
"timeOfSample": "2020-01-02T09:30:00Z",
"uncertaintyInMilliseconds": 60000
},
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2020-01-02T09:30:00Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
The response received is '401 Unauthorized'
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "95bd23c3-76e6-472b-9c6d-74d436e1eb61"
},
"payload": {
"code": "INVALID_ACCESS_TOKEN_EXCEPTION",
"description": "Access token is not valid."
}
}
I figured out the issue. I was mistakenly sending parameters: Content-Type=application/json and charset=UTF-8 as well including them in the header - my bad. You just need to include them in the header.

Error creating a customContent on a confluence addon

Today I was trying to create a confluence addon for my company and I've try following atlassian documents.
My problem comes trying to run the express app when adding a new customContent to the atlassian-connect.json, after running npm start I get the following error.
Failed to register with host https‍://admin:xxx#xxx.atlassian.net/wiki (200)
{"type":"INSTALL","pingAfter":300,"status":{"done":true,"statusCode":200,"con
tentType":"application/vnd.atl.plugins.task.install.err+json","subCode":"upm.
pluginInstall.error.descriptor.not.from.marketplace","source":"https‍://1a0adc
8f.ngrok.io/atlassian-connect.json","name":"https‍://1a0adc8f.ngrok.io/atlassi
an-connect.json"},"links":{"self":"/wiki/rest/plugins/1.0/pending/b88594d3-c3
c2-4760-b687-c8d860c0a377","alternate":"/wiki/rest/plugins/1.0/tasks/b88594d3
-c3c2-4760-b687-c8d860c0a377"},"timestamp":1502272147602,"userKey":"xxx","id":"xxx"}
Add-on not registered; no compatible hosts detected
This is my atlassian-connect.json file:
{
"key": "my-add-on",
"name": "Ping Pong",
"description": "My very first add-on",
"vendor": {
"name": "Angry Nerds",
"url": "https://www.atlassian.com/angrynerds"
},
"baseUrl": "{{localBaseUrl}}",
"links": {
"self": "{{localBaseUrl}}/atlassian-connect.json",
"homepage": "{{localBaseUrl}}/atlassian-connect.json"
},
"authentication": {
"type": "jwt"
},
"lifecycle": {
"installed": "/installed"
},
"scopes": [
"READ"
],
"modules": {
"generalPages": [
{
"key": "hello-world-page-jira",
"location": "system.top.navigation.bar",
"name": {
"value": "Hello World"
},
"url": "/hello-world",
"conditions": [{
"condition": "user_is_logged_in"
}]
},
{
"key": "customersViewer",
"location": "system.header/left",
"name": {
"value": "Hello World"
},
"url": "/hello-world",
"conditions": [{
"condition": "user_is_logged_in"
}]
}
],
"customContent": [
{
"key": "customer",
"name": {
"value": "Customers"
},
"uiSupport": {
"contentViewComponent": {
"moduleKey": "customersViewer"
},
"listViewComponent": {
"moduleKey": "customerList"
},
"icons": {
"item": {
"url": "/images/customers.png"
}
}
},
"apiSupport": {
"supportedContainerTypes": ["space"]
}
}
]
}
}
Does anybody has an idea on whats going on?
The contentViewComponent can't find the generalPage it is referencing in moduleKey.
From the docs:
In the snippet above, the moduleKey “customersViewer” maps to a
generalPage module we have defined in our add-on. This generalPage is
passed the context parameters we specify, and visualizes our content
accordingly.
If you change the generalPage with the key hello-world-page-confluence to customersVieweryou be able to install and get up and running.

Resources