Is it possible to get the artifact name from the mule sdk? - mule

Is it possible to get the artifact (app) name using the mule sdk when developing a custom mule connector?
I can get the artifact name by creating a parameter and having the user pass it in:
#Parameter
private String artifactName;
but can it be retrieved from an injected service?

Artifact name and application name could be different. The more clean approach is to add a configuration to the module/connector for the application name and set it in the application. If the user sets it to the built-in placeholder${app.name} it will contain the actual application name.

Related

How to configure Azure AD SSO programmatically for gallery-based application?

I need to configure Azure Active Directory SSO for Tableau Server gallery app as it is under MS documentation link programmatically. Are there useful powershell cmdlets / rest apis?
I create application from gallery using graph api from Step 1 on MS docs.
To get available templates:
GET https://graph.microsoft.com/beta/applicationTemplates
To create template app:
POST https://graph.microsoft.com/beta/applicationTemplates/{id}/instantiate
Now I need to configure SAML SSO from code and assign users. Is there an easy way to do that? I tried Set-AzureADApplication but it didn't do the job for me. The enterprise application is still not set.
Maybe it's not supported yet? I believe there can be some workaround. I would be grateful for any help.
Are there useful powershell cmdlets / rest apis?
Yes, but per my test, we need to do that into two parts.
1.Set the Sign-on URL, to do this, we need to call Microsoft Graph - Update serviceprincipal.
In the Graph Explorer, use the request below.
PATCH https://graph.microsoft.com/beta/servicePrincipals/<object-id of the service principal>
{
"loginUrl": "https://azure.signtest.link"
}
Note: In the request above, you need to use the object-id of the service principal(Enterprise application), not the AD App(App registeration). You can find it in the Azure AD in the portal -> Enterprise Application -> find your Tableau Server -> get the Object ID like below.
2.Set the Identifier and Reply URL, we could do this via Powershell Set-AzureADApplication.
Sample:
$Identifiers = #(
"http://www.tableau.com/products/server",
"https://azure.idtest.link"
)
$ReplyUrls = #(
"https://azure.rptest.link/wg/saml/SSO/index.html"
)
Set-AzureADApplication -ObjectId <object-id of the AD App> -IdentifierUris $Identifiers -ReplyUrls $ReplyUrls
For the object-id of the AD App, navigate to the Azure AD in the portal -> App registrations -> find your Tableau Server. After running the command, the settings will map to the enterprise application.
Check the result in the portal:
Update:
Not sure if it is a bug, if I create a new app without setting the Identifier and Reply URL manually in the portal, then just use the powershell above to set them, they will not map to the portal.
But if we check the service principal(enterprise application) directly via Microsoft Graph, we can see the powershell actually affected the service principal.
If we configure the settings manually in the portal first, then use the powershell to update them with other values, it works.
And it looks there is no way to set the Default Reply URL via powrshell or API, if we set the Reply URL which is different from the one set manually in the portal, it will have a prompt like below.
But if we look into it, actually the Default option is checked.
Update2:
Eventually, I find the trick, it is not a bug, we just need to set the preferredSingleSignOnMode for the service principal first via Microsoft Graph, then we won't need to configure that in the portal manually.
Sample:
PATCH https://graph.microsoft.com/beta/servicePrincipals/<object-id of the service principal>
{
"preferredSingleSignOnMode":"saml",
"loginUrl": "https://azure.signtest.link"
}

How to resolve 500 Message:An error has occurred while Accessing API from Azure?

I am working with Azure Mobile Services API, my API on the local host running well. I have checked with the help of Swagger UI. but when I publish my API to azure then after that by accessing the API with Swagger I got this error.
500 : {"Message":"An error has occurred."} http://xxxxxxxxxxx.azurewebsites.net/swagger/docs/v1
Now if I type this route http://xxxxxxxxxxx.azurewebsites.net/tables/doctor?ZUMO-API-VERSION=2.0.0
to any table then I got the result,
why not with swagger?
help me to get on the right path.
Please make sure your XML file is available on the same location as you have defined in the swagger UI properties on Azure.
I would highly recommend to generate your swagger xml file
Steps :
Right click on webapi project
Properties => build tab
Output section - in different folder other than bin.
For example : App_Start\\{ProjectName}.xml

IBM MobileFirst Platform - How to Call resource WS (JAX-RS) in navigator?

I'm trying to make a simple example of a connection to a WS (JAX-RS), when I call from the browser, I should return a string but I get the following error message:
missing_authorization, this is the URL to access the resource (REST):
http://localhost:10080/PruebaWSProject/adapters/MyAdapter/users/pramirez
When I test it directly from MobileFirst Studio using "Call MobileFirst Adapter", it works perfectly.
It seems to be a problem with HTTP authentication, apparently I have to set something in the XML file server: authenticationConfig.xml, but I do not know what I have to put and I read the following in a web:
Disabling the authentication requirement for a specific procedure.
You can do so by adding the securityTest="wl_unprotected" property to the element in the adapter XML file.
I do not know how to turn off the security to call the resource to obtain the chain. The name of the classes generated by the Java adapter are: MyAdapterResource and MyAdapterApplication.
Java Adapters are protected by default.
When you use "Call MobileFirst Adapter", a test token is automatically added to help you preview.
If you want to test your adapter outside of the wizard, you have 2 main options:
Disable security by adding #OAuthSecurity(enabled=false) before your procedure code (in MyAdapterResource). Keep in mind that your procedure will no longer be protected. See Protecting Adapters.
Generate a test token manually. You can request a test token which you will add to your HTTP headers. See In Postman
The instructions you saw regarding securityTest="wl_unprotected" are for JavaScript adapters, not Java.

WSO2 API Manager - Make the API Store Default Component

I'm using WSO2 API Manager 1.8 and it has been deployed on the cloud according this guide with a HAProxy. I have been given a IP https://192.168.X.XYZ to access the API Manager which is the IP given to the cloud instance.
My problem is when I type https://192.168.X.XYZ, it loads the publisher, what I want to do is load the API store rather than loading the publisher. Basic idea is that a domain will be mapped to the above IP address. So when an user type the domain user should be shown the API Store not the API Publisher.
https://192.168.X.XYZ -> https://myapistore.com
How can I configure API store to be loaded rather than the API Publisher in WSO2 API Manager 1.8?
In <AM_HOME>/repository/components/plugins directory, there is a bundle called "org.wso2.am.styles_1.x.x.jar". Open this jar and find its component.xml file which resides in META-INF directory. You should notice that default-context has been pointed to publisher. Change it to store as follows and update the jar.
<context>
<context-id>default-context</context-id>
<context-name>store</context-name>
<protocol>http</protocol>
<description>API Publisher Default Context</description>
</context>
After doing the above restart the server.
Now, if you try to access the root URL of the server https://192.168.X.XYZ, it will be redirected to the API Store (https://192.168.X.XYZ/store/).

WSO2 Governance Registry : retrieve a Service's URL by service name?

How to retrieve and call a Service's URL stored in WSO2 Governance Registry "GREG" by providing the service name; is there any simple Java method provided by the GREG API to get exactly and only the url of a service and not the whole Metadata ?
Thanks.
Ouufff finally, spent the entire night to solve this problem:
Registry governanceRegistry = GovernanceUtils
.getGovernanceUserRegistry(registry, username);
**// All governance artifacts should be loaded.
GovernanceUtils.loadGovernanceArtifacts((UserRegistry) governanceRegistry);**
ServiceManager manager = new ServiceManager(governanceRegistry);
But i stil don't know why all governance artifacts should be loaded before using it.
Please refer Governance Artifact Search Sample documentation,it's demonstrating how to search governance artifacts using attributes and get the paginated results. You can refer this blog as well.