How can I use a CredentialPicker with AuthenticationProtocol set to Custom?
To do this, I need to set CustomAuthenticationProtocol to something to avoid an ArgumentException. However, if I set it to a value other than one of the predefined values, I receive the following exception:
A specified authentication package is unknown. (Exception from HRESULT: 0x80070554)
Related
I have noticed the abp localization provide a Format Arguments mechanism to help generate realtime local string by this way, and I want to know how can I do the same thing in calling a BusinessException while all its overloads are not suitable for this purpose.
Please see the documentation: https://docs.abp.io/en/abp/latest/Exception-Handling#exception-localization
It is possible to set an exception code and data related to the exception. Then ABP automatically localizes the exception message by also using the data arguments you've provided.
Example exception:
throw new BusinessException("App:010046")
.WithData("UserName", "john");
And the related localization entry in the json file:
"App:010046": "Username should be unique. '{UserName}' is already taken!"
It is not using {0}, {1}... but using parameter names instead.
I've added a new user to AD using JNDI LDAP. And I've enable the account programmatically as well. However if I attempt to add the user to an AD Group I get and error that indicates that an Entry Already exists. See Results below for exception thrown.
"Domain Admins" is the group name but it appears that its complaining that I'm trying to re-add the group. Here is my code.
Any example that I've found on forums does it similarly.
public void addUserToGroup() throws NamingException {
String groupDN = "CN=Domain Admins,CN=Users,DC=mydomain,DC=org";
// Create the objectclass
Attribute objClasses = new BasicAttribute("objectClass");
objClasses.add("top");
objClasses.add("group");
// Create a entry set of attributes
Attributes attrs = new BasicAttributes();
Attribute member = new BasicAttribute("member", getUserDN("jdoe"));
// Add these to the container
attrs.put(objClasses);
attrs.put(member);
try {
context.modifyAttributes(groupDN, DirContext.ADD_ATTRIBUTE, attrs);
} catch (Exception e) {
LOGGER.severe("Failed to Add User to Domain Admins -- ");
}
}
public String getUserDN(String aUsername) {
return "CN=" + aUsername + ",CN=" + "Users,DC=mydomain,DC=org";
}
This is the resulting exception thrown...
javax.naming.NameAlreadyBoundException: [LDAP: error code 68 - 00000562: UpdErr: DSID-031A11E2, problem 6005 (ENTRY_EXISTS), data 0
]; remaining name 'CN=Domain Admins,CN=Users,DC=mydomain,DC=org'
You are adding an attribute with values that already exist on the object: objectClass.
When you use DirContext.ADD_ATTRIBUTE the LDAP server assumes new values, not replacing existing values.
Why are you adding that to the modification? Just adding the member attribute is enough.
Try without the objectClass attribute and it should work.
It's been a while since I've worked w/JNDI (which is a 20 year old library BTW), but I still have something to offer here.
LDAP errors generally mean what they say, so I don't doubt the error means exactly what it says (entry already exists). This of course contradicts your code, which appears to only want to do an ldapmodify operation.
I would want to see what happens "on the wire", so how about grabbing the LDAP protocol using tcpdump or wireshark, and check to see if it's actually sending a MOD or an ADD operation? In theory this error 68 should only come from an ADD, so let's see those packets and find out what really happened.
Into a flow i raised and error and i would like to test it in Munit.
The documentation doesn't seem to contain and explain this particular case.
what is the text that i need to insert into :
expected error type
expected exception
All errors thrown in Mule contain meta-data including a TYPE.
For example, here is a list of some specific HTTP: errors thrown by the HTTP module:
HTTP:UNSUPPORTED_MEDIA_TYPE
HTTP:CONNECTIVITY
HTTP:INTERNAL_SERVER_ERROR
HTTP:METHOD_NOT_ALLOWED
Each module's documentation should contain all specific error types thrown by that module. Here is the HTTP one example: https://docs.mulesoft.com/connectors/http/http-documentation#throws
In your screenshot for example it uses APIKIT module. APIKIT module has its own errors again. Think of it as certain Java classes throwing custom exceptions specific to that class.
And here is a full list of core error types you can catch like EXPRESSION for example:
https://docs.mulesoft.com/mule-runtime/4.1/mule-error-concept
The attribute expectedErrorType expects an error type ID that needs to be defined inside the application being tested. This attribute allows you to validate that a defined error type in your application is thrown. If you define an errorType that does not exists in your application, the test does not run.
<munit:test name="MUnit-test-suite"
description="Test Error Type"
expectedErrorType="FTP:ILLEGAL_PATH">
...
</munit:test>
This Error Type test expects that an FTP operation will throw an FTP:ILLEGAL_PATH error.
You will need to configure this for your specific type you are expecting.
The attribute expectException expects a literal exception class name (canonical form). When you provide a literal value, it should take the form of the canonical class name of the exception that is expected. In these cases, Mule always throws a MuleMessagingException. MUnit validates the provided classname if the underlying cause of the MuleMessagingException thrown is of the exact same type.
<munit:test name="testExceptions"
description="Test Exceptions"
expectedException="java.lang.RuntimeException">
...
</munit:test>
If you define that your test expects an exception and none is thrown, the test fails immediately.
So you don't need to provide both.
Actually what I am trying to do is whenever exception/error occurs in application it will come to catch exception strategy, here I'm trying to create a xml request which contains application name, timestamp and error details and calling one rest service with this xml as input. Could you please help me in doing this..?? Thanks in Advance
There nothing you can do access those expressions in dataweave, you might need to store those in flowVars then access the flowVars in dataweave like flowVars."name_of_var".
Regards,
Ralph
You can find error handling block in your flow.
Inside that you can catch the exception with the MEL syntax.
#[Exception.causedBy(corresponding class)]
once if there is an exception based on some class then inside that you can define your strategy.
In general you can catch any exception by #[Exception!=null]
If there is any exception occurs automatically the control will be passed here.
In that you can setpayload #[app.name], #[server.dateTime],#[Exception.getMessage()]
Then you can proceed as you want.
Thanks!
I am figuring out someone else's code and I am trying to generate a proxy out of one of the services and it generates the following error...
System.InvalidOperationException: An exception was thrown in a call to a policy export extension. Extension: System.ServiceModel.Channels.SymmetricSecurityBindingElement Error: Specified argument was out of the range of valid values. Parameter name: parameters ----> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Can anyone direct me in the right direction. how can I solve the problem?
Its just a configuration issue. It means the Service is not configured correctly.