BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-06-2004, 05:59 PM   #1 (permalink)
New Member
 
Join Date: Oct 2004
Location: Vancouver
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Post Thanks: 1
Thanked 0 Times in 0 Posts
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 (permalink)
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Post Thanks: 1
Thanked 0 Times in 0 Posts
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 (permalink)
New Member
 
Join Date: Oct 2004
Location: Vancouver
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2004
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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