I need to create a win forms app in VS 2013, which will take a wsdl file as a webReference. It will invoke an wsdl:operation "Init" which will send the following xml to the web service :
The Wsdl contains the operation:
<wsdl:operation name="Init">
<wsdl:input message="wl:InitRequest"/>
<wsdl:output message="wl:InitResponse"/>
</wsdl:operation>
The Init SOAP xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.asdfgh.org/lala/log">
<soapenv:Header/>
<soapenv:Body>
<web:Init>
<web:Phase>`TST`</web:Phase>
</web:Init>
</soapenv:Body>
</soapenv:Envelope>
It will send a response back InitResponse:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.asdfgh.org/lala/log">
<soapenv:Header/>
<soapenv:Body>
<wl:InitResponse xmlns:wl="http://www.asdfgh.org/lala/log">
<Data>
<NUMBER>1234</NUMBER>
<TEXT1>ABCDEF</TEXT1>
<TEXT2>QWERTY</TEXT2>
</Data>
</wl:InitResponse>
</soapenv:Body>
</soapenv:Envelope>
How to I read the response back and show the ouput in a MessageBox.Show();
Below is the class formed by the wsdl on the Init.
public partial class Init {
private string phaseField;
/// <remarks/>
public string Phase {
get {
return this.phaseField;
}
set {
this.phaseField = value;
}
}
}
Below is the class formed by the wsdl on InitResponse(funny thing is, it did not create any class named InitResponse. It has created InitResponseData -- I wonder why)
public partial class InitDSDResponseData {
private string NUMBERField;
private string TEXT1Field;
private string TEXT2Field;
/// <remarks/>
public string NUMBER {
get {
return this.NUMBERField;
}
set {
this.NUMBERField = value;
}
}
/// <remarks/>
public string TEXT1 {
get {
return this.TEXT1Field;
}
set {
this.TEXT1Field = value;
}
}
/// <remarks/>
public string TEXT2 {
get {
return this.TEXT2Field;
}
set {
this.TEXT2Field = value;
}
}
}
On a button click event, I want to show the response xml in a Message Box as a string. How should I proceed? How do I invoke the Init operation through c#?
Related
This a sample SOAP request I'm sending to a WS which is deployed in WAS 8.5
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://xmlns.scania.com/logistics/schema/transport/v1">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-37" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
password
</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v1:TransportInformationRequest>
<!--1 or more repetitions:-->
<v1:ChassisNumber>2105909</v1:ChassisNumber>
</v1:TransportInformationRequest>
</soapenv:Body>
</soapenv:Envelope>
What I want is to retrieve the username and password sent in the above request. I flipped through the Java EE api but couldn't find the correct way to do the same. I have written a painful code in the SOAPHandler as below :
#Override
public boolean handleMessage(SOAPMessageContext context) {
// TODO Auto-generated method stub
Boolean isOutbound = (Boolean) context
.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
log.info("In TransportHandler.handleMessage(...) " + isOutbound);
if (!isOutbound) {
SOAPMessage soapMsg = context.getMessage();
SOAPEnvelope soapEnv;
try {
soapEnv = soapMsg.getSOAPPart().getEnvelope();
SOAPHeader soapHeader = soapEnv.getHeader();
Iterator<SOAPElement> securityHeaderElements = soapHeader
.getChildElements(new QName(
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
"Security", "wsse"));
if (securityHeaderElements.hasNext()) {
SOAPElement securityHeaderElement = securityHeaderElements
.next();
log.info("*****securityHeaderElement : "
+ securityHeaderElement + " type is "
+ securityHeaderElement.getClass().getName());
Iterator<Node> securityHeaderChildren = securityHeaderElement
.getChildElements();
while (securityHeaderChildren.hasNext()) {
Node securityElement = securityHeaderChildren.next();
log.info("*****securityElement : "
+ securityElement.getClass().getName());
if (securityElement instanceof com.ibm.ws.webservices.engine.xmlsoap.SOAPElement) {
com.ibm.ws.webservices.engine.xmlsoap.SOAPElement securitySOAPElement = (com.ibm.ws.webservices.engine.xmlsoap.SOAPElement) securityElement;
log.info("*****securitySOAPElement "
+ securitySOAPElement);
Iterator<Node> securitySOAPElementChildren = securitySOAPElement
.getChildElements();
while (securitySOAPElementChildren.hasNext()) {
Node securitySOAPElementChild = securitySOAPElementChildren
.next();
log.info("*****securitySOAPElementChild : "
+ securitySOAPElementChild);
if (securitySOAPElementChild instanceof com.ibm.ws.webservices.engine.xmlsoap.SOAPElement) {
com.ibm.ws.webservices.engine.xmlsoap.SOAPElement securitySOAPChildElement = (com.ibm.ws.webservices.engine.xmlsoap.SOAPElement) securitySOAPElementChild;
log.info("*****securitySOAPChildElement "
+ securitySOAPChildElement);
}
}
}
}
}
} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
log.info("Returning from TransportHandler.handleMessage(...)");
return true;
}
What is the efficient way to get the username and password ?
I query to a webservice with this operation:
public schema.cupservices.Output callService(
#WebParam(partName = "inputMessage", name = "inputMessage", targetNamespace = "http://schema/cupServices") schema.cupservices.Input inputMessage);
inputMessage is of a type "Input":
public abstract class Input {
#XmlElement(required = true)
protected LoginData loginData;
public LoginData getLoginData() {
return loginData;
}
public void setLoginData(LoginData value) {
this.loginData = value;
}
}
when I try to call the service on Talend using the TSOAP component and with SOAPUI, both take as input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cup="http://schema/cupServices">
<soapenv:Header/>
<soapenv:Body>
<cup:inputMessage>
<cup:loginData>
<cup:username>user</cup:username>
<cup:password>123</cup:password>
</cup:loginData>
</cup:inputMessage>
</soapenv:Body>
</soapenv:Envelope>
I get this error:
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: Unable to create an instance of schema.cupservices.Input
- with linked exception:
[java.lang.InstantiationException]]</faultstring>
I know that Input is an abstract class, but the wsdl of the webservice is set in this way...
How can I resolve this problem?
Thanks
I receive a message from AAA nested children. I want every child BBB replace the value of CCC. Then send the modified message on AAA
<AAA>
<BBB>
<CCC>test1</CCC>
<DDD>testing</DDD>
</BBB>
<BBB>
<CCC>test2</CCC>
<DDD>testing</DDD>
</BBB>
<BBB>
<CCC>test3</CCC>
<DDD>testing</DDD>
</BBB>
<BBB>
<CCC>test4</CCC>
<DDD>testing</DDD>
</BBB>
<BBB>
<CCC>test5</CCC>
<DDD>testing</DDD>
</BBB>
</AAA>
I do it:
<iterate continueParent="true" expression="/AAA/BBB">
<target>
<sequence>
<property name="newValue" value="chang testing" scope="default" type="STRING"/>
<enrich>
<source clone="false" type="custom" xpath="get-property('newValue')"/>
<target action="replace" type="custom" xpath="//DDD"/>
</enrich>
</sequence>
</target>
</iterate>
But changing the message is not stored on
If you use iterate mediator you have to aggregate the results to get the modified message. How ever this can be achieved by using xslt mediator. Sample proxy configuration would be look like follows
<proxy name="yourpproxy" transports="https http" startOnLoad="true" trace="disable">
<description/>
<target>
<inSequence>
<xslt key="yourxsltkey"/>
<send/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
where yourxsltkey is the key to your xslt definition. This can be either declare as local entry or in registry. As an sample here i have defined as a local entry.
<localEntry key="yourxsltkey">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<AAA xmlns="http://ws.apache.org/ns/synapse">
<xsl:for-each select="AAA/BBB">
<BBB><xsl:value-of select="CCC"/></BBB>
</xsl:for-each>
</AAA>
</xsl:template>
</xsl:stylesheet>
</localEntry>
I wrote my mediator and use it for this purpose
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.impl.dom.NamespaceImpl;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.apache.synapse.Mediator;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;
import org.apache.synapse.mediators.eip.EIPUtils;
import org.apache.synapse.util.MessageHelper;
import org.apache.synapse.util.xpath.SynapseXPath;
import org.jaxen.JaxenException;
import java.util.List;
public class SplitMediator extends AbstractMediator {
private String sequenceRef = null;
private String xpathString = null;
private String attachPathString = null;
private String uri = null;
private String prefix = null;
public boolean mediate(MessageContext synCtx) {
if (sequenceRef == null || xpathString == null || attachPathString == null) {
handleException("Error creating a mediate due to sequenceRef or xpathString attachPathString is null", synCtx);
return false;
}
try {
SOAPEnvelope envelope = synCtx.getEnvelope();
Mediator sequenceMediator = synCtx.getSequence(sequenceRef);
SynapseXPath expression = new SynapseXPath(xpathString);
if (uri != null && prefix != null)
expression.addNamespace(new NamespaceImpl(uri, prefix));
SynapseXPath attachPath = new SynapseXPath(attachPathString);
if (uri != null && prefix != null)
attachPath.addNamespace(new NamespaceImpl(uri, prefix));
List<OMNode> splitElements = EIPUtils.getDetachedMatchingElements(envelope, synCtx, expression);
MessageContext templateMessageContext = MessageHelper.cloneMessageContext(synCtx);
OMElement omElement = getOMElementByXPath(attachPath, envelope, synCtx);
for (OMNode o : splitElements) {
MessageContext changeCtx = getNewMessageContextToSequence(templateMessageContext, o, attachPath);
sequenceMediator.mediate(changeCtx);
List elementList = EIPUtils.getMatchingElements(changeCtx.getEnvelope(), expression);
OMNode changeElement = (OMNode) elementList.get(0);
omElement.addChild(changeElement);
}
} catch (JaxenException e) {
handleException("Error evaluating split XPath expression : " + xpathString, e, synCtx);
} catch (AxisFault af) {
handleException("Error creating an iterated copy of the message", af, synCtx);
}
return true;
}
private MessageContext getNewMessageContextToSequence(MessageContext templateMessageContext, OMNode o, SynapseXPath attachPath) throws AxisFault, JaxenException {
MessageContext synCtx = MessageHelper.cloneMessageContext(templateMessageContext);
SOAPEnvelope envelope = synCtx.getEnvelope();
OMElement omElement = getOMElementByXPath(attachPath, envelope, synCtx);
omElement.addChild(o);
return synCtx;
}
private OMElement getOMElementByXPath(SynapseXPath attachPath, SOAPEnvelope envelope, MessageContext synCtx) {
Object attachElem = attachPath.evaluate(envelope, synCtx);
if (attachElem != null &&
attachElem instanceof List && !((List) attachElem).isEmpty()) {
attachElem = ((List) attachElem).get(0);
}
// for the moment attaching element should be an OMElement
if (attachElem != null && attachElem instanceof OMElement) {
return ((OMElement) attachElem);
} else {
handleException("Error in attaching the splitted elements :: " +
"Unable to get the attach path specified by the expression " +
attachPath, synCtx);
}
return null;
}
///////////////////////////////////////////////////////////////////////////////////////
// Getters and Setters //
///////////////////////////////////////////////////////////////////////////////////////
public String getXpathString() {
return xpathString;
}
public void setXpathString(String xpathString) {
this.xpathString = xpathString;
}
public String getAttachPathString() {
return attachPathString;
}
public void setAttachPathString(String attachPathString) {
this.attachPathString = attachPathString;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getSequenceRef() {
return sequenceRef;
}
public void setSequenceRef(String sequenceRef) {
this.sequenceRef = sequenceRef;
}
}
How do you create a POJO containing a list that the container has attributes?
Typically when creating a POJO of a list you do it the following way:
To represent the following XML structure:
<folder>
<messages>
<message>
<subject>XXXX</subject>
...
</message>
<message>
<subject>XXXX</subject>
...
</message>
</messages>
</folder>
#XmlRootElement(name = "folder")
public class Folder {
#XmlElement
private List<Message> messages;
...
}
#XmlRootElement(name = "message")
public class Message {
#XmlElement
private String subject;
...
}
But how do you represent a POJO when there are attributes at the messages tag? i.e.
<folder>
<messages total="45" start="3">
<message>
<subject>XXXX</subject>
...
</message>
<message>
<subject>XXXX</subject>
...
</message>
</messages>
</folder>
Do you create a POJO specifically for messages and then map a List of Message with an annotation of #XmlValue or something along those lines?
Thanks for your help guys.
The following approach could be used with any JAXB (JSR-222) implementation.
Messages
Using just the standard JAXB (JSR-222) APIs you will need to introduce a Messages class to your model.
import java.util.List;
import javax.xml.bind.annotation.*;
public class Messages {
#XmlElement(name="message")
private List<Message> messages;
#XmlAttribute
private int start;
#XmlAttribute
public int getTotal() {
if(null == messages) {
return 0;
} else {
return messages.size();
}
}
}
Folder
Then you will need to modify your Folder class to reference the new Messages class.
import javax.xml.bind.annotation.*;
#XmlRootElement
#XmlAccessorType(XmlAccessType.FIELD)
public class Folder {
private Messages messages;
}
Message
import javax.xml.bind.annotation.*;
#XmlAccessorType(XmlAccessType.FIELD)
public class Message {
private String subject;
}
Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group
If you use MOXy as your JAXB provider then you could leverage the #XmlPath extension and do the following.
Folder
import java.util.List;
import javax.xml.bind.annotation.*;
import org.eclipse.persistence.oxm.annotations.XmlPath;
#XmlRootElement
#XmlAccessorType(XmlAccessType.FIELD)
public class Folder {
#XmlElementWrapper
#XmlElement(name="message")
private List<Message> messages;
#XmlPath("messages/#start")
private int start;
#XmlPath("messages/#total")
public int getTotal() {
if(null == messages) {
return 0;
} else {
return messages.size();
}
}
}
Message
import javax.xml.bind.annotation.*;
#XmlAccessorType(XmlAccessType.FIELD)
public class Message {
private String subject;
}
jaxb.properties
To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
Demo
import java.io.File;
import javax.xml.bind.*;
public class Demo {
public static void main(String[] args) throws Exception {
JAXBContext jc = JAXBContext.newInstance(Folder.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
File xml = new File("src/forum14372107/input.xml");
Folder folder = (Folder) unmarshaller.unmarshal(xml);
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(folder, System.out);
}
}
input.xml/Output
<?xml version="1.0" encoding="UTF-8"?>
<folder>
<messages start="1" total="2">
<message>
<subject>XXXX</subject>
</message>
<message>
<subject>YYYY</subject>
</message>
</messages>
</folder>
For More Information
http://blog.bdoughan.com/2010/07/xpath-based-mapping.html
http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html
http://blog.bdoughan.com/2010/09/jaxb-collection-properties.html
http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html
I have a simple POJO as a webservice that is mapped to, lets say /public/authenticate :
WebService
#SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class AuthWS{
#WebMethod
public boolean doAuthenticate(String securityToken) {
....
}
}
This webservice doesn't requre authentication and is not a protected resource.
I do have other private webservices mapped to path : /private/ws/*;
For the moment I use a security-domain that has a Database login module setup. It works fine, but user first needs to authenticate trought a web form based that makes a post request to /j_security_check. Only after this step user can use other private webservices.
I want to perform a programatically authentication after client calls this doAuthenticate method. So that client to be able to invoke other /private/ws/* webservice methods.
I'll type what I want to achieve:
#WebService
#SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class AuthWS{
#WebMethod
public boolean doAuthenticate(String securityToken) {
SomeSecurityManager manager= SomeSecurityManager.getDefaultManager()
Map<String,Object> map = new HashMap<String, Object>();
map.put("MY_CUSTOM_SECURITY_TOKEN",securityToken);
manager.doLogin(map);
// after webservice method returns, client should now be able to invoke other private webservice
// this means that the manager should associate with this session an authenticated user.
// in order that authorization to work.
}
}
And my CustomLoginModule :
class CustomLogModule implements LoginModule {
...
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
// store what's needed
}
public boolean login(){
// get securityToken send from the SomeSecurityManager and validate it.
// get user information from that token and store into Subject object.
}
}
And in my CustomLoginModule that implements JAAS LoginModule to check that securityToken with a custom logic, verify if it right signed with a public key for example. That securityToken contains information about principal.
If you need more details, feel free to ask.
Thanks.
EDITED
1.) Created custom-login-module.jar together with module.xml
<module xmlns="urn:jboss:module:1.1" name="custom.login.module">
<resources>
<resource-root path="custom-login-module.jar"/>
</resources>
<dependencies>
<module name="org.picketbox"/>
<module name="javax.api"/>
<module name="org.slf4j"/>
</dependencies>
</module>
2.) Added custom-login-module.jar and module.xml into jboss-as-7.1.1.Final\modules\custom\login\module
3.) custom-login-module.jar contains :
public class CustomCallbackHandler implements CallbackHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomCallbackHandler.class);
private String token;
public CustomCallbackHandler(String token) {
this.token= token;
}
public String getToken() {
return token;
}
#Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof TokenCallback) {
((TokenCallback) callback).setToken(token);
}
}
}
}
public class TokenCallback implements Callback {
private static final Logger LOGGER = LoggerFactory.getLogger(TokenCallback.class);
private String token;
public TokenCallback() {
}
public String getToken() {
return token;
}
public void setToken(String token) {
LOGGER.info("Setting token = " + token);
this.token = token;
}
}
public class CustomLoginModule extends AbstractServerLoginModule {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomLoginModule.class);
#Override
public boolean login() throws LoginException {
LOGGER.info("Doing login()");
boolean login = super.login();
super.loginOk = true;
return login;
}
#Override
protected Principal getIdentity() {
return new UserPrincipal("some user");
}
#Override
protected Group[] getRoleSets() throws LoginException {
return new Group[]{new MyGroup()}; // that and has name 'dummy'
}
}
These are only dummy implementations.
My web application is deployed from within a .war archive. And it Contains following :
jboss-web.xml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE jboss-web
PUBLIC -//JBoss//DTD Web Application 2.3V2//EN
http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd>
<jboss-web>
<security-domain>custom-auth</security-domain>
</jboss-web>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>WebApp</display-name>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>All resources</web-resource-name>
<description>Protects all private resources</description>
<url-pattern>/private/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>dummy</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-role>
<role-name>dummy</role-name>
</security-role>
<servlet>
<servlet-name>Private</servlet-name>
<servlet-class>com.company.private.PrivateWs</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Private</servlet-name>
<url-pattern>/private/PrivateWs</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AuthWS</servlet-name>
<servlet-class>com.company.auth.AuthWS</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AuthWS</servlet-name>
<url-pattern>/AuthWS</url-pattern>
</servlet-mapping>
</web-app>
#WebService
#SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class AuthWS{
private static final Logger LOGGER = LoggerFactory.getLogger(AuthWS.class);
#WebMethod
public boolean doAuthenticate(String token) {
tryProgrammaticLogin(token);
return true;
}
private void tryProgrammaticLogin(String token) {
LoginContext loginContext = null;
try {
loginContext = new LoginContext("custom-auth", new CustomCallbackHandler(token));
loginContext.login();
} catch (LoginException e) {
LOGGER.info("Some problem occured when trying to custom login.", e);
}
}
}
The call to doAuthenticate from my ws client works but the problem is that after try ProgrammaticLogin an exception occurs. And the PrivateWS is not accesible by client.
17:33:40,901 INFO [com.mycompany.AuthWS] (http--0.0.0.0-8080-1) Some problem occured when trying to custom login.: javax.security.auth.login.LoginException: Login Failure: all modules ignored
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:921) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [rt.jar:1.6.0_26]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [rt.jar:1.6.0_26]
standalone.xml from jboss configuration directory contains:
<security-domain name="custom-auth">
<authentication>
<login-module code="com.mycompany.CustomLoginModule" flag="required" module="custom.login.module"/>
</authentication>
</security-domain>
Please tell me if the way of doing authentication with creating a new LoginContext object is the right way of doing. I can't understand why this problem occurs.