-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
beanshooter/src/eu/tneitzel/beanshooter/plugin/providers/T3AuthenticationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package eu.tneitzel.beanshooter.plugin.providers; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import javax.naming.Context; | ||
import javax.management.remote.JMXConnector; | ||
import javax.management.remote.JMXConnectorFactory; | ||
import javax.rmi.ssl.SslRMIClientSocketFactory; | ||
|
||
import eu.tneitzel.beanshooter.operation.BeanshooterOption; | ||
import eu.tneitzel.beanshooter.plugin.IAuthenticationProvider; | ||
|
||
/** | ||
* T3 compatible authentication provider. Has only some small deviations from the default | ||
* authentication provider. | ||
* | ||
* @author Tobias Neitzel (@qtc_de) | ||
*/ | ||
public class T3AuthenticationProvider implements IAuthenticationProvider | ||
{ | ||
/** | ||
* Authentication to T3 endpoints requires the credentials to be passed in a different | ||
* format than for the usual JMX auth. Moreover, an additional provider package needs | ||
* to be defined. | ||
* | ||
* @param username the desired username for T3 authentication | ||
* @param password the desired password for T3 authentication | ||
* @return environment that should be used during the newClient call | ||
*/ | ||
public Map<String,Object> getEnv(String username, String password) | ||
{ | ||
HashMap<String,Object> env = new HashMap<String,Object>(); | ||
|
||
env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote"); | ||
|
||
if(username != null && password != null) | ||
{ | ||
env.put(Context.SECURITY_PRINCIPAL, username); | ||
env.put(Context.SECURITY_CREDENTIALS, password); | ||
} | ||
|
||
return env; | ||
} | ||
} |