Hi Brent,

Yes you are right, My XDBC app server has *authentication scheme as "digest"
*. XDBC app sever *privilege *section is also null (Also tried by
mentioning "*xdmp:login*" as a value here) . Via XDBC i am always getting
retrun as *"false"*.
But via Queryconsole with *authentication scheme *as *"application-level"* i
am getting* "true"*. when i set *authentication scheme as "digest" *for
QueryConsole then i am not able to execute xdmp:login. i have mentioned
description below.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I have written an xquery file on file system module. i have following code
inside *.xqy* file>>

*//authHelper.xqy*

*declare variable $userName as xs:string * external; *
*declare variable $password as xs:string * external;*


xdmp:log(fn:concat("UserName: ",$userName,"|Password: ",$password))
,
*xdmp:login($userName,$password)*

I have a java module where i receive the user name and password and i am
sending that username and password to marklogic as:

*//AuthHelper.java*

        private static final String *userName *=
ResourceReader.getProperty("*mladminuser*"); //Reading username from
property file
        private static final String *password*= ResourceReader.getProperty("
*mladminpass*");//Reading password from property file
        private static final String *url*= ResourceReader.getProperty("*
mlurl*"); //Reading url "localhost:8006/toolkit" from property file

        //To get the connection from marklogic.
 *public static Session getConnection*(String *userName*, String *password*,
String *url*) {
 URI uri;
Session session=null;
try {
 uri = new URI(prepareConnectionUrl(userName,password,url));
ContentSource contentSource = ContentSourceFactory
 .newContentSource(uri);
session = contentSource.newSession();
} catch (URISyntaxException e) {
 e.printStackTrace();
} catch (XccConfigException e) {
e.printStackTrace();
 }
return session;
}
*
*
      private static String *prepareConnectionUrl*(String userName,String
password,String url){
   StringBuffer sb=new StringBuffer("xdbc://");
    sb.append(userName);
   sb.append(":");
   sb.append(password);
    sb.append("@");
   sb.append(url);
    return sb.toString();
}

public static void main(String[] args){
// User name and password here is coming form outside some client, i have
tajken here as hardcoded.
                String user= "abhinav";  //It will come from outside client
                String  pass="abhinav"; //It will come from outside client

authenticate(user,pass);
}

public static String authenticate(String user,String pass){
             try  {
 Session session = *getConnection*(user, password,url);// admin user and
password to get connection
 ModuleInvoke req = session.newModuleInvoke("authHelper.xqy");
req.setNewStringVariable("userName", user);
 req.setNewStringVariable("password", pass);
 ResultSequence rs = session.submitRequest(req);
while (rs.hasNext()) {
 ResultItem rsItem = rs.next();
XdmItem item = rsItem.getItem();
 System.out.println(item); //Should be true, but getting false.
 }
} catch (Exception e) {
 e.printStackTrace();
}

}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

*Executed the xdmp:login via QueryConsole:*

When i am executing xdmp:login("abhinav","abhinav") in QueryConsole i am
getting error as "[1.0-ml] XDMP-APPREQ: xdmp:login("abhinav",
"abhinav") --* Application
level authentication required*"

When i set the QConsole with *authentication scheme *as *"application-level"
then *xdmp:login("abhinav", "abhinav")  is returning *true*.


Please guide me. Thanks a ton in advance.

Regards,
Abhinav Kumar Mishra


On Thu, May 16, 2013 at 5:59 PM, <[email protected]>wrote:

> Send General mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://developer.marklogic.com/mailman/listinfo/general
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of General digest..."
>
>
> Today's Topics:
>
>    1. Re: XDMP:LOGIN(USER, PASS),       not working when using through
>       XDBC. (abhinav mishra)
>    2. Re: string-join output not as expected (sini narayanan)
>    3. Re: XDMP:LOGIN(USER, PASS), not working when using through
>       XDBC. (Brent Hartwig)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 16 May 2013 12:52:21 +0530
> From: abhinav mishra <[email protected]>
> Subject: Re: [MarkLogic Dev General] XDMP:LOGIN(USER, PASS),    not
>         working when using through XDBC.
> To: [email protected]
> Message-ID:
>         <
> cacp7mw8azedbnpbp44cbkdg2jkaiyfhh6c4uhuog0mwfqug...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
> Need your help.
>
> I have a query related to xdmp:login() method.
>
> I am creating a java webservice which is connected to marklogic via XDBC
> app server,I get username and password from input request and i am trying
> to validate the user by using "xdmp:login(username,password)" but i am
> always getting "false" as a result even i am providing the correct username
> and password.
>
> When i am using the same username and password and running
> "xdmp:login(someuser,password)" in query console i am getting true, but via
> XDBC it gives "false" as a result.
>
> Can anyone help me to let me know whether "xdmp:login()" works with XDBC or
> not ? or it works with only HTTP servers where we can set
> "application-level" authentication?
>
> Thanks,
> Abhinav kumar mishra
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://developer.marklogic.com/pipermail/general/attachments/20130516/55a03b15/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Thu, 16 May 2013 13:39:02 +0530
> From: sini narayanan <[email protected]>
> Subject: Re: [MarkLogic Dev General] string-join output not as
>         expected
> To: MarkLogic Developer Discussion <[email protected]>
> Message-ID:
>         <
> capb-bkpbujuim4a-b_ywkg8c_gipypyyam9pkvk-nq7mx+4...@mail.gmail.com>
> Content-Type: text/plain; charset="windows-1252"
>
> Yes!!! this is exactly what I want. But I need to perform string join to
> this symbol. Is there a way to do that?
> Because, I have a lot many variables to be inserted to the root node value
> after concatenation.
>
> Thanks,
> Sini
>
>
>
> On Thu, May 16, 2013 at 12:03 PM, Geert Josten <[email protected]
> >wrote:
>
> > Hi Sini,
> >
> >
> >
> > I think you are looking for something like this:
> >
> >
> >
> > let $phonesymbol := <SYMB>T</SYMB>
> >
> > let $tel := ?03 22 24 08 49?
> >
> > return
> >
> >       <root>France ? {$phonesymbol}  {$tel} - 14h-18h - closed.</root>
> >
> >
> >
> > Your phonesymbol really isn?t a string, so don?t use string-join or
> > concat, but insert it into the parent tree as a node.
> >
> >
> >
> > Kind regards,
> >
> > Geert
> >
> >
> >
> > *Van:* [email protected] [mailto:
> > [email protected]] *Namens *sini narayanan
> > *Verzonden:* donderdag 16 mei 2013 7:34
> > *Aan:* MarkLogic Developer Discussion
> > *Onderwerp:* Re: [MarkLogic Dev General] string-join output not as
> > expected
> >
> >
> >
> > I need this to be inserted as a value of a node.
> >
> >
> >
> > for example:
> >
> > <root>France - <SYMB> T </ SYMB>  03 22 24 08 49 - 14h-18h - closed.
> > </root>
> >
> >
> >
> > Thanks,
> >
> > Sini
> >
> >
> >
> > On Thu, May 16, 2013 at 10:56 AM, Tim <[email protected]> wrote:
> >
> > Are you trying to insert the phone symbol as a node or as a string in a
> > document where the content is mixed?
> >
> >
> >
> > Can you provide a better example of the xml file and how you want this to
> > fit in it?
> >
> >
> >
> > *From:* [email protected] [mailto:
> > [email protected]] *On Behalf Of *sini narayanan
> > *Sent:* Thursday, May 16, 2013 1:19 AM
> > *To:* MarkLogic Developer Discussion
> > *Subject:* Re: [MarkLogic Dev General] string-join output not as expected
> >
> >
> >
> > Hi Tim,
> >
> >
> >
> > I get the output as &lt;SYMB&gt;T&lt;/SYMB&gt; test
> >
> >
> >
> > Is it not possible to get it as <SYMB>T</SYMB> test ?
> >
> >
> >
> > I'm inserting this values in an xml file.
> >
> >
> >
> > Thanks,
> >
> > Sini
> >
> >
> >
> > On Thu, May 16, 2013 at 10:21 AM, Tim <[email protected]> wrote:
> >
> > First of all your symbol needs to be a string and not a node.  Secondly
> > you need to use the correct syntax for string-join:
> >
> > * *
> >
> > *let **$phonesymbol* := "<SYMB>T</SYMB>"
> >
> > *return **fn:string-join*((*$phonesymbol*, "test"), " ")
> >
> > Tim  Meagher
> >
> >
> >
> > *From:* [email protected] [mailto:
> > [email protected]] *On Behalf Of *sini narayanan
> > *Sent:* Thursday, May 16, 2013 12:43 AM
> > *To:* MarkLogic Developer Discussion
> > *Subject:* [MarkLogic Dev General] string-join output not as expected
> >
> >
> >
> > Hi,
> >
> >
> >
> > I have the following code
> >
> >
> >
> > let $phonesymbol       := <SYMB>T</SYMB>
> >
> > return
> >
> > $phonesymbol
> >
> >
> >
> > output : <SYMB>T</SYMB>
> >
> >
> >
> > let $phonesymbol       := <SYMB>T</SYMB>
> >
> > return
> >
> > fn:string-join($phonesymbol || " " || "test")
> >
> >
> >
> > output : T test
> >
> >
> >
> > How do I modify this to get the output as "<SYMB>T</SYMB> text"
> >
> >
> >
> > Thanks,
> >
> > Sini
> >
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://developer.marklogic.com/mailman/listinfo/general
> >
> >
> >
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://developer.marklogic.com/mailman/listinfo/general
> >
> >
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://developer.marklogic.com/mailman/listinfo/general
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://developer.marklogic.com/pipermail/general/attachments/20130516/7eff52ea/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Thu, 16 May 2013 06:56:15 -0500
> From: Brent Hartwig <[email protected]>
> Subject: Re: [MarkLogic Dev General] XDMP:LOGIN(USER, PASS), not
>         working when using through XDBC.
> To: MarkLogic Developer Discussion <[email protected]>
> Message-ID:
>         <
> d8b7d3ed1417b44ab885e22b6bffa6897945add...@ausp01vmbx30.collaborationhost.net
> >
>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi, Abhinav,
>
> This section may help you select the right authentication type for your
> deployment:
> http://docs.marklogic.com/guide/security/authentication#chapter.  Avoid
> "application-level" when you'd like MarkLogic to authenticate the user.
>
> If you were to set your HTTP app server to "digest", MarkLogic will prompt
> you the user for their credentials.  When you do this, do the credentials
> work?  I'm guessing not and that you'll want to reset the user's password
> in MarkLogic, or simplify it to make sure some character isn't interfering.
>  I think this got me once, but can't recall for sure.
>
> Now take that to the XDBC app server.  It too can be set to "digest".  On
> all app server types, one can use "digestbasic" when willing to have an
> unencrypted password sent over the network when the encrypted one doesn't
> work.  From within Java, using the XCC library, how are you attempting to
> use the credentials (e.g., one of the
> ContentSourceFactory.newContentSource() signatures)?
>
> If the app server's privilege setting has a value, make sure one of the
> user's roles is also granted that privilege.  To temporarily remove this as
> a factor, clear this setting until you're able to authenticate.
>
> -Brent
>
> From: [email protected] [mailto:
> [email protected]] On Behalf Of abhinav mishra
> Sent: Thursday, May 16, 2013 3:22 AM
> To: [email protected]
> Subject: Re: [MarkLogic Dev General] XDMP:LOGIN(USER, PASS), not working
> when using through XDBC.
>
>
> Hi all,
> Need your help.
>
> I have a query related to xdmp:login() method.
>
> I am creating a java webservice which is connected to marklogic via XDBC
> app server,I get username and password from input request and i am trying
> to validate the user by using "xdmp:login(username,password)" but i am
> always getting "false" as a result even i am providing the correct username
> and password.
>
> When i am using the same username and password and running
> "xdmp:login(someuser,password)" in query console i am getting true, but via
> XDBC it gives "false" as a result.
>
> Can anyone help me to let me know whether "xdmp:login()" works with XDBC
> or not ? or it works with only HTTP servers where we can set
> "application-level" authentication?
>
> Thanks,
> Abhinav kumar mishra
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://developer.marklogic.com/pipermail/general/attachments/20130516/5407e936/attachment.html
>
> ------------------------------
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
> End of General Digest, Vol 107, Issue 41
> ****************************************
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to