Crossbar.io - Restrict user to subscribe to only two topics - autobahn

I had seen in the Crossbar.io documentation, that we can set role to publish only to specific topic. But how can I set a role to publish exactly matching two topics rather than pattern based matching.

You can use a configuration like this (see Static Authorization in the docs):
"realms": [
{
"name": "realm1",
"roles": [
{
"name": "role1",
"permissions": [
{
"uri": "com.example.topic1",
"publish": true
},
{
"uri": "com.example.topic2",
"publish": true
}
]
}
]
}
]

Related

How do I get custom metrics done in micrometer to graphite?

Similar to How to get Micrometer to output all custom metrics but I am trying to do it for Graphite.
I have a custom metric counter defined as:
#Bean
Counter successfulAuthenticationRequests(MeterRegistry meterRegistry) {
return Counter.builder(metricPrefix + ".auth.authentication.success")
.tag("group", "authentication")
.tag("state", "ok")
.register(meterRegistry);
}
In actuator I can see the value
❯ curl http://localhost:28082/actuator/metrics/spring.cloud.gateway.auth.authentication.success | jq
{
"name": "spring.cloud.gateway.auth.authentication.success",
"measurements": [
{
"statistic": "COUNT",
"value": 2
}
],
"availableTags": [
{
"tag": "node",
"values": [
"docker-desktop"
]
},
{
"tag": "service",
"values": [
"ds_gateway"
]
},
{
"tag": "state",
"values": [
"ok"
]
},
{
"tag": "group",
"values": [
"authentication"
]
}
]
}
The environment is set up as
management.graphite.metrics.export.host: graphite
management.graphite.metrics.export.enabled: "true"
management.graphite.metrics.export.port: 2004
And I can see that there's data added to Graphite so I presume the connection is all valid.
However, I can't see my custom counter. I tried to use a different prefix as well and none of it worked.
Is there anything I may be missing?
I also tried to disable tag support by adding
management.graphite.metrics.export.graphiteTagsEnabled: "false"
I get more metrics with this set in Spring but not for my custom metrics.

Using google workspace admin API, how to identify slack workspace of the my org users who log into slack using company's email via Gsuite SSO?

I am capturing the logins of my org users into slack using google workspace admin reports API as mentioned in the doc here: https://developers.google.com/admin-sdk/reports/v1/appendix/activity/saml#login_success
I want to identify the workspace that these users are login into. How can I identify this?
Here's the sample response that I get from the reports API:
{
"kind": "admin#reports#activities",
"etag": "\"SsISqFfgRYY11XaGpPyQF5FTf1EAwqUmKLMPaD85FHw/evu1UTmScwnBzMj7rPtBftM3N2k\"",
"items": [
{
"kind": "admin#reports#activity",
"id": {
"time": "2022-05-25T17:51:08.913Z",
"uniqueQualifier": "35251594669533645",
"applicationName": "token",
"customerId": "C02a9qd29"
},
"etag": "\"SsISqFfgRYY11XaGpPyQF5FTf1EAwqUmKLMPaD85FHw/U-RQigEfldlDShA5VdJAIizlnsQ\"",
"actor": {
"email": "vibhu#cloudeagle.ai",
"profileId": "116721330888590133060"
},
"ipAddress": "18.206.76.246",
"events": [
{
"name": "authorize",
"parameters": [
{
"name": "client_id",
"value": "606092904014-s1u3idjanlbhr4ns5b1hcjgfn63cr9nh.apps.googleusercontent.com"
},
{
"name": "app_name",
"value": "Slack"
},
{
"name": "client_type",
"value": "WEB"
},
{
"name": "scope_data",
"multiMessageValue": [
{
"parameter": [
{
"name": "scope_name",
"value": "openid"
},
{
"name": "product_bucket",
"multiValue": [
"IDENTITY"
]
}
]
},
{
"parameter": [
{
"name": "scope_name",
"value": "https://www.googleapis.com/auth/userinfo.email"
},
{
"name": "product_bucket",
"multiValue": [
"IDENTITY"
]
}
]
},
{
"parameter": [
{
"name": "scope_name",
"value": "https://www.googleapis.com/auth/userinfo.profile"
},
{
"name": "product_bucket",
"multiValue": [
"IDENTITY"
]
}
]
}
]
},
{
"name": "scope",
"multiValue": [
"openid",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
]
}
]
}
]
},
}
I am wondering if it is possible to identify the slack workspace from the above response or would it need other API endpoints and parameters.
keep in mind SAML is an authentication method that allows a Service Provider such as Slack in this scenario, use Google credentials as Identity Provider (IdP). That being said once the Authentication flow is completed usually the IdP doesn't have any control or access to the app activity.
In other words once the login is completed Google is blind about what users do in the app interface.
For that reason I am afraid what you are trying to achieve is not possible. In the Google Reports API link you shared data you can obtain is limited to failed/successful login details.
Testing the call to the Reports API you can see there is no additional details useful to your purpose:

KrakenD catchall path

I have two paths in KrakenD config: /city/toronto and /city/vancouver. I want to create another path /city/other that would catch every other city that would be provided.
I know at first glance one would say: make the city a path parameter or one would even say make the city a query parameter. I have considered these options and they are not viable.
Is there a way in Krakend To define a catchall or fallback endpoint? I though wildcard could allow me to do this but I am not seeing how this would work.
In earlier versions of KrakenD this was not possible, but since 1.4 you can use routes that before were considered to be conflicting. The following example does exactly what you are expecting. Run with the -d flag:
krakend run -d -c krakend.json where the content of the JSON file is:
{
"version": 2,
"endpoints": [
{
"endpoint": "/city/vancouver",
"backend": [
{
"url_pattern": "/__debug/vancouver",
"host": [
"http://localhost:8080"
]
}
]
},
{
"endpoint": "/city/toronto",
"backend": [
{
"url_pattern": "/__debug/toronto",
"host": [
"http://localhost:8080"
]
}
]
},
{
"endpoint": "/city/{other}",
"backend": [
{
"url_pattern": "/__debug/catchall",
"host": [
"http://localhost:8080"
]
}
]
}
]
}

FHIR - Contained Resources and Referencing

I am still new to FHIR and trying to connect the dots.
If I have a resource that I want to contain other resources, can I refer to it by element name (#myElementName) or do I need to use the contained resource id? (#myDeviceId).
I've included sample code below. What I would like to accomplish is to have a Basic resource that has two extensions: TestConfiguration(Device) and DigitalSample(ImagingStudy). I would like for both of these resources to be contained.
PS: I generated the code below using custom classes and the .net API.
Thank you much!
{
"resourceType": "TestInput",
"contained": [
{
"resourceType": "TestConfiguration",
"id": "TestConfigurationId",
"contained": [
{
"resourceType": "DeviceDefinition",
"modelNumber": "ABC123"
}
],
"definition": {
"reference": "#definition"
}
},
{
"resourceType": "DigitalSample",
"id": "DigitalSampleId"
}
],
"extension": [
{
"url": "http://MyOrganization.com/fhir/R4/StructureDefinition/Basic-TestConfiguration",
"valueReference": {
"reference": "#testConfiguration"
}
},
{
"url": "http://MyOrganization.com/fhir/R4/StructureDefinition/Basic-DigitalSample",
"valueReference": {
"reference": "#digitalSampleId"
}
}
]
}
Every local reference must point to an id of a contained resource.
In your case it should be:
"reference": "#TestConfigurationId"
"reference":"#DigitalSampleId"
Always check https://www.hl7.org/fhir/ for what you need to do. Always check the FHIR version

How to configure Spring Actuator for httptrace and Rest Template?

I have a Spring boot application that it executes several parallel requests, of course, using RestTemplate class.
I configured Spring actuator,to see the Http Trace.
management.endpoints.web.exposure.include=httptrace
When I execute: http://localhost:8080/actuator/httptrace
I see information but related to the request I am doing to my Spring Mvc exposed controllers, but I don't see any info related to the request I am doing internally.
So how can I achieve that? Could you show me some example?
Thanks in advance folks!
You can use Spring Boot /actuator/metrics/http.server.requests to get all endPoints which are executed with their count, exception, outcome, status, total time, etc as follow.
If you want to see details for particular endPoint then you can do it by calling request as follow
localhost:8889/actuator/metrics/http.server.requests?tag=uri:<endPoint>
localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets
localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets&tag=status:200
You will get COUNT as how many times particular endPoint has been
called
You will get COUNT as how many times particular endPoint has been
called with a particular Status
To get the average time to execute endPoint you can do
TOTAL_TIME/COUNT for particular endPoint as well as for the whole
application
More Details are Here
localhost:8889/actuator/metrics/http.server.requests
{
"name": "http.server.requests",
"description": null,
"baseUnit": "seconds",
"measurements": [
{
"statistic": "COUNT",
"value": 3
},
{
"statistic": "TOTAL_TIME",
"value": 0.21817219999999998
},
{
"statistic": "MAX",
"value": 0.1379249
}
],
"availableTags": [
{
"tag": "exception",
"values": [
"MethodArgumentTypeMismatchException",
"None"
]
},
{
"tag": "method",
"values": [
"GET"
]
},
{
"tag": "uri",
"values": [
"/{id}.*",
"/user/asset/getAsset/{assetId}",
"/user/asset/getAllAssets"
]
},
{
"tag": "outcome",
"values": [
"CLIENT_ERROR",
"SUCCESS"
]
},
{
"tag": "status",
"values": [
"400",
"404",
"200"
]
}
]
}

Resources