We are using nodejs as my backend application and react native in front end. And azure application insights for logging. In UI side, we are redirecting to Stripe checkout page(external page) for payment and then coming back to our application's confirmation page. Here we are loosing the flow on end-to-end transaction. My requirement is to link pre-stripe and post-stripe operation into one single flow. For this my approach of solving this problem is accessing OPERATIONID and pass it to stripe and receive it back from Stripe and use it in confirmation page so that we will one single flow. I Need help in guiding me to the right documentation/ solution proposals.
I read some articles(eg: How to get Application Insights operation id in javascript?) and figured out that operationId is a uniqueID which gets created out of my application and cant access it in the application. I tried to use below code and got response of that operationID as "ai.operation.id" but seems like this is not the right pattern(value) of operationId.
import { defaultClient } from 'applicationinsights';
const telemetryClient = defaultClient;
// tslint:disable-next-line:no-console
console.log(telemetryClient.context.keys[`operationId`]);
The main function of operationId is to help tracking distributed systems so you can correlate requests. So as given in this documentation in nodejs client, you should set the setDistributedTracingMode to appInsights.DistributedTracingModes.AI_AND_W3C as shown below.
const appInsights = require("applicationinsights");
appInsights
.setup("<your ikey>")
.setDistributedTracingMode(appInsights.DistributedTracingModes.AI_AND_W3C)
.start()
You should be able to get the operation id using the following code snippet.
const AppInsights = require("applicationinsights");
var context = AppInsights.getCorrelationContext();
var oid = context.operation.id;
If it does not solve your problem then, I would suggest you to set telemetry.context.operation.id to be a unique id by yourself and confirm if this is tracked by the Application Insights properly.
Also note that the latest version of the JavaScript SDK (SDK v2) for Application Insights have some changes as given in this document.
Moved context.operation to context.telemetryTrace. Some fields were also changed (operation.id --> telemetryTrace.traceID).
To keep the trace ID unique, where you previously used Util.newId(), now use Util.generateW3CId(). Both ultimately end up being the operation ID.
For more information read this log custom telemetry document.
I have an twilio autopilot similar to appointment schedule sample in twilio, I want it to have a memory before its even initiated, I have a B2C service, where I provide the platform to connect with their customers. Now each business offers different service so I want to be able to identify whose call my bot is attending and respond to the person based on that information.
Right now I have hardcoded business ID, but I want businesses to be able to handover to the bot with their business ID, I have read the documentation but it doesn't say how to handle call redirect as my Bot would be handling calls only.
Twilio developer evangelist here.
You can do this with Twilio Studio!
"Inbound Context lets you add data to the Autopilot Memory before starting a dialogue with the bot. In a Studio flow, it allows you to pass Flow variables created by other widgets in your flow seamlessly into Autopilot to be used in bot conversations. You can then parse these variables directly from the Memory JSON included in Autopilot's request to your application" (more info here):
-Memory.CarMake
-Memory.CarModel
You could alternatively use a URL like this one to pass Inbound Context with Memory where any message sent to a bot with this URL will insert CarModel, CarMake, and CarYear into the Autopilot Memory.
https://channels.autopilot.twilio.com/v1/<ACCOUNT_SID>/<ASSISTANT_SID>/twilio-messaging?Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}
That URL would go for a SMS bot and go in where you place the webhook URL for your Twilio phone number, but you could similarly modify it for WhatsApp (https://channels.autopilot.twilio.com/v1///twilio-messaging/whatsapp?Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}), Voice, Custom Channels (https://channels.autopilot.twilio.com/v1///custom/{YourCustomChannelName}?Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}) etc.
TwiML for voice would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Connect action="https://www.example.com/autopilot">
<Autopilot Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}>UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Autopilot>
</Connect>
</Response>
Let me know if this helps at all!:D
You can utilize Inbound Context, as detailed below.
Inbound Context
https://www.twilio.com/changelog/inbound-context
Inbound Context lets you add data to the Autopilot Memory before
starting a dialogue with the bot. It can help you make the bot
experience more personalized and contextual by making information like
names, purchase histories, account numbers etc. stored in third-party
systems available directly in the bot conversation.
I found a way to handle it, and it may not be the best way, but its really helpful for me.
So what I have done is I created an API that responds back with Twml
Similar to this
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Connect action="https://www.example.com/autopilot">
<Autopilot Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}>UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Autopilot>
</Connect>
</Response>
Now I purchased number and set its webhook URL to the API I created, within that API, I can pass parameter and then create memory with those params
Here is my API handler in Nodejs:
const VoiceResponse = require('twilio').twiml.VoiceResponse
const voice = (req, res, next) => {
const response = new VoiceResponse()
const connect = response.connect()
connect.autopilot({
TargetTask: 'greeting',
Memory: `{"companyId": "${req.params.id}"}`
},
process.env.AUTOPILOT_SID)
res.type('text/xml')
res.send(response.toString())
}
I hope this helps somebody who is looking to create dynamic memory based on different numbers, or to create a bot that works for multi-tenant platform
We implement the Sign-In on iOS using the Google API in our project. Customers must have a possibility to select the HostedDomain to limit the allowed account pull to the single domain.
SignIn.SharedInstance.HostedDomain = "domainName.com";
works perfectly.
The problem is when we want to Logout the user and log in it back with unrestricted HostedDomain
SignIn.SharedInstance.HostedDomain == null; // <-Default Value
When I try to set it to
SignIn.SharedInstance.HostedDomain=string.empty;
I filter everything.
When I try to set it to null
SignIn.SharedInstance.HostedDomain=null;
I get the exception.
Calling:
SignIn.SharedInstance.Dispose();
doesn't help.
The question is: How is possible to reset the HostedDomain filtering to the initial stage - allow everything without of the app restart.
Our implementation based on Xamarin iOS native, but we see the same problem in Swift or Objective-C.
The wrapper for the Gooogle SDK we use:
Xamarin.Google.iOS.SignIn
I wanted to block some users for accessing some services in JHipster.
How can I authorize a particular user for accession a ReST web Service in JHipster?
For blocking the access on the backend side, use the #Secured annotation on selected methods (rest entry points) in web/rest/*resource.java.
Example:
#RequestMapping(value = "/data-fields",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
#Timed
#Secured({AuthoritiesConstants.ADMIN})
public List<DataFieldDTO> getAllDataFields() {
log.debug("REST request to get all DataFields");
return dataFieldService.findAll();
}
As Gaël Marziou says, I believe that what you are trying to do is to block it on frontend's part. If it´s the case a possible way to do it is managing the use of "has-authority". For example: has-authority="ROLE_ADMIN"
So what you should do is the opposite, create an authority which allows some users to have access to ReST web Service
use has-authority and put your expected authority it will work 100% . tasted
write it on your html tag has-authority="ROLE_ADMIN" or your expected user
On /config/SecurityConfiguration.java
You can change access of the api that you want like
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/**").authenticated()
.antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/auth/*").hasAnyAuthority("ADMIN", "USER")
Or you can use auth.inMemoryAuthentication()
for more information read link below:
https://www.baeldung.com/spring-security-expressions
I have an XPage that I want to restrict access to. So in the ACL property I wrote the following code:
<xp:this.acl>
<xp:acl>
<xp:this.entries>
<xp:aclEntry name="TSC Time Tracking Administrators"
right="EDITOR" type="GROUP" fullName="Administrator">
</xp:aclEntry>
</xp:this.entries>
</xp:acl>
</xp:this.acl>
This code works on the web - I receive an authentication challenge - but on the client I get a 401 error with "You do not have sufficient authorization to perform this operation"
I think this must be a bug in the client. I am running 9.0.1.
Does anybody know if this is a bug or if there is a work around?