Basic Authorization Header Encoding

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Basic Authorization Header Encoding

David Lacy

Hello,

 

I would like to base64 encode a username:password for use in a Basic Authorization Header but I cannot find a way to do so. I found the following thread with a similar request, but it did not lead to a conclusion:

 

http://lists.w3.org/Archives/Public/www-forms/2010Sep/0012.html

 

Thanks,

 

David Lacy

Falvey Library Technology Services

Villanova University

library.villanova.edu

610-519-7361

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Basic Authorization Header Encoding

Erik Bruchez
Administrator
David,

It would be nice if we exposed such a function but it's not the case right now.

But you can call some Java code to do this. It's not so pretty but it works:

<xforms:output xmlns:jstring="java:java.lang.String"
xmlns:base64="java:org.orbeon.oxf.util.Base64"

value="base64:encode(jstring:getBytes(jstring:new('abc'), 'utf-8'))"/>

-Erik

On Fri, Dec 16, 2011 at 7:13 AM, David Lacy <[hidden email]> wrote:

> Hello,
>
>
>
> I would like to base64 encode a username:password for use in a Basic
> Authorization Header but I cannot find a way to do so. I found the following
> thread with a similar request, but it did not lead to a conclusion:
>
>
>
> http://lists.w3.org/Archives/Public/www-forms/2010Sep/0012.html
>
>
>
> Thanks,
>
>
>
> David Lacy
>
> Falvey Library Technology Services
>
> Villanova University
>
> library.villanova.edu
>
> 610-519-7361
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Basic Authorization Header Encoding

Erik Bruchez
Administrator
David,

I was reminded that Saxon has an extension function doing this:

http://www.saxonica.com/documentation/extensions/functions/stringtobase64binary.xml

That might be a bit prettier.

-Erik

On Tue, Dec 20, 2011 at 10:15 PM, Erik Bruchez <[hidden email]> wrote:

> David,
>
> It would be nice if we exposed such a function but it's not the case right now.
>
> But you can call some Java code to do this. It's not so pretty but it works:
>
> <xforms:output xmlns:jstring="java:java.lang.String"
> xmlns:base64="java:org.orbeon.oxf.util.Base64"
>
> value="base64:encode(jstring:getBytes(jstring:new('abc'), 'utf-8'))"/>
>
> -Erik
>
> On Fri, Dec 16, 2011 at 7:13 AM, David Lacy <[hidden email]> wrote:
>> Hello,
>>
>>
>>
>> I would like to base64 encode a username:password for use in a Basic
>> Authorization Header but I cannot find a way to do so. I found the following
>> thread with a similar request, but it did not lead to a conclusion:
>>
>>
>>
>> http://lists.w3.org/Archives/Public/www-forms/2010Sep/0012.html
>>
>>
>>
>> Thanks,
>>
>>
>>
>> David Lacy
>>
>> Falvey Library Technology Services
>>
>> Villanova University
>>
>> library.villanova.edu
>>
>> 610-519-7361
>>
>>
>>
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email] mailing
>> list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Basic Authorization Header Encoding

David Lacy
Thanks, both solutions worked perfectly.

David Lacy
Falvey Library Technology Services
Villanova University
library.villanova.edu
610-519-7361


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik
> Bruchez
> Sent: Wednesday, December 21, 2011 2:02 PM
> To: [hidden email]
> Subject: [ops-users] Re: Basic Authorization Header Encoding
>
> David,
>
> I was reminded that Saxon has an extension function doing this:
>
> http://www.saxonica.com/documentation/extensions/functions/stringtobase64binar
> y.xml
>
> That might be a bit prettier.
>
> -Erik
>
> On Tue, Dec 20, 2011 at 10:15 PM, Erik Bruchez <[hidden email]> wrote:
> > David,
> >
> > It would be nice if we exposed such a function but it's not the case right now.
> >
> > But you can call some Java code to do this. It's not so pretty but it works:
> >
> > <xforms:output xmlns:jstring="java:java.lang.String"
> > xmlns:base64="java:org.orbeon.oxf.util.Base64"
> >
> > value="base64:encode(jstring:getBytes(jstring:new('abc'), 'utf-8'))"/>
> >
> > -Erik
> >
> > On Fri, Dec 16, 2011 at 7:13 AM, David Lacy <[hidden email]> wrote:
> >> Hello,
> >>
> >>
> >>
> >> I would like to base64 encode a username:password for use in a Basic
> >> Authorization Header but I cannot find a way to do so. I found the
> >> following thread with a similar request, but it did not lead to a conclusion:
> >>
> >>
> >>
> >> http://lists.w3.org/Archives/Public/www-forms/2010Sep/0012.html
> >>
> >>
> >>
> >> Thanks,
> >>
> >>
> >>
> >> David Lacy
> >>
> >> Falvey Library Technology Services
> >>
> >> Villanova University
> >>
> >> library.villanova.edu
> >>
> >> 610-519-7361
> >>
> >>
> >>
> >>
> >>
> >> --
> >> You receive this message as a subscriber of the [hidden email]
> >> mailing list.
> >> To unsubscribe: mailto:[hidden email]
> >> For general help: mailto:[hidden email]?subject=help
> >> OW2 mailing lists service home page: http://www.ow2.org/wws
> >>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws