BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-06-2004, 05:59 PM   #1
dinouye
New Member
 
Join Date: Oct 2004
Location: Vancouver
Posts: 12
Default HTTP Authentication on Rogers WAP Gateway

Please Login to Remove!

Was curious has anyone else out there had any problems using HTTP Authentication and a WAP gateway?

I am able to use both the WAP gateway and the Sim MDS to access a site without any problems. However as soon as I turn on HTTP Authentication the WAP Gateway version throws a net.rim.device.cldc.io.waphttp.WAPIOException. The SIM/MDS version works fine with HTTP Authentication. The offending code seems to be where I am setting the authentication header:

httpConnection.setRequestProperty("Authorization", password);

perhaps I need another header? I'm sifting through the documentation but haven't come across anything.

Any help/advice/pointers are greatly appreciated!

Thanks

Darren



On a separate note is there any way to get at the message in WAPIOException when you are building a midlet blackberry app? my app can't seem to utilize the RIM libraries when it is being built as a midlet, I've tried to include the libraries but the compiler won't allow me.
Offline  
Old 10-12-2004, 07:20 PM   #2
Mark Rejhon
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Default

Try this....

Quote:
You can add the header with "WWW-Authenticate" and then base64 the username/password. Of course that is in the clear. There are more complex challenge-response authentication mechanisms than "Basic" such as NTLM, but you will have to write the code to prepare the response from the challenge.

http://www.w3.org/Protocols/HTTP/1.0/spec.html#BasicAA
You might have already done this... but just making sure you did!
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Old 10-12-2004, 07:22 PM   #3
Mark Rejhon
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Default

Edit: I found you've already done this -- in this post

Try the Search Results "HTTP Authentication" and see if any of this is relevant...

Please reply here to let all of us know how you solved your problem, if you do!
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Old 10-13-2004, 04:46 PM   #4
dinouye
New Member
 
Join Date: Oct 2004
Location: Vancouver
Posts: 12
Default Thanks

Thanks Mark,

I'll go over my headers again and see if I'm missing anything and report finding back here.

cheers,

Darren
Offline  
Old 10-15-2004, 08:48 AM   #5
jbartel
Knows Where the Search Button Is
 
Join Date: Sep 2004
Posts: 17
Default

I assume you are trying to do Basic Authentication (not NTLM/Digest). If so, I found 3 things:

1. With a WAP gateway, it only works if you leave the username/password as plaintext (base64 encoding does not work).
2. With IDEN (6510/7510) or MDS you need to base64 encode the username/password string
3. On the 3.6 OS when using WAP, some http headers get dropped on a http POST if the post data is over a certain size (I think the size is ~38 bytes if I remember correctly).

Here is the code I am using for basic authentication which works:
Code:
private static String AUTHORIZATION           = "Authorization";
private static String BASIC                   = "Basic";


private void addAuthorizationSettingsxxx40;String username, String password, HttpConnection connectionxxx41;
xxx123;
	ifxxx40; username.lengthxxx40;xxx41; > 0 && password.lengthxxx40;xxx41; > 0 xxx41;
	xxx123;
		//Base64 encode only for IDEN, use plaintext with WAP        
        	ifxxx40; RadioInfo.getNetworkTypexxx40;xxx41; == RadioInfo.NETWORK_IDEN xxx41; 
		xxx123; 
			encoded = encodeUsernamePasswordxxx40;username, passwordxxx41;; 
		xxx125; else 
		xxx123; 
			encoded = username + "xxx58;" + password; 
		xxx125;
        	ifxxx40; encoded.lengthxxx40;xxx41; > 0 xxx41;
        	xxx123;
        		connection.setRequestPropertyxxx40;AUTHORIZATION, BASIC + " " + encodedxxx41;;
        	xxx125;
	xxx125;
xxx125;
The encodeUsernamePassword function just creates a new String with the username and password separated by a ":" (i.e. username:password), and base64 encodes that string.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


1PC 72*72mm directly Connect AC 0-20A Analog Ammeter Panel AMP Current Meter picture

1PC 72*72mm directly Connect AC 0-20A Analog Ammeter Panel AMP Current Meter

$9.39



Analog Panel AMP VOLT Current Ammeter Voltmeter Voltage Gauge 10A 50V DH-670 DC  picture

Analog Panel AMP VOLT Current Ammeter Voltmeter Voltage Gauge 10A 50V DH-670 DC

$12.99



Battery Tester DC 0-80V0-350A SOC AH VOLT AMP Capacity Tester Voltmeter Ammeter picture

Battery Tester DC 0-80V0-350A SOC AH VOLT AMP Capacity Tester Voltmeter Ammeter

$43.50



1PC Analog Ammeter Panel AMP Current Meter 100x120mm 59C2 DC 0-1500mA picture

1PC Analog Ammeter Panel AMP Current Meter 100x120mm 59C2 DC 0-1500mA

$9.29



LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter picture

LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter

$10.95



LCD Digital MULTIMETER Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meters picture

LCD Digital MULTIMETER Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meters

$7.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.