1

Topic: User authentication with WMS web service

According to the documentation (http://data.nbn.org.uk/Documentation/We … WMSDetails) the NBN Gateway WMS - unlike the SOAP web services - does not require a registration key.

I have no problem using the WMS with public access - i.e. not supplying any user credentials - but problems when I try to supply username and userkey parameters. In the documentation example, the userkey is given as 'HASHED_PASSWORD'.

I'm having trouble with this. I cannot find any specification in the NBN Gateway documentation of what the 'HASHED_PASSWORD' should be. I've used a routine (VB.NET) to create an MD5 hashed password with mixed results - this morning it worked for one user and not another and now it works for neither!

Can I have some more details with respect to exactly what is required by the WMS service in terms of encoding the passwords?

Many thanks,

Rich

Richard Burkmar
Biodiversity Project Officer
Field Studies Council

2

Re: User authentication with WMS web service

Hello Rich

Password encoding for WMS should be the same as that used for the restful service returning atlas grade maps. Try using the generate login parameters tool provided in the documentation page for the atlas grade maps (http://data.nbn.org.uk/Documentation/We … rade_Maps/) to generate the MD5 hash of your password and then use this as a parameter in the WMS URL.

Note that the password is case sensitive so if you are having problems check whether your password contains upper case as well as lower case. (on login to the NBN Gateway click forgotten password and your password should be emailed to you). Let me know how you get on

Best wishes

Graham

3

Re: User authentication with WMS web service

Thanks Graham,

Maybe I had finger trouble putting in the passwords yesterday because today everything works!

In case anyone else looks at this thread and is after a .NET implementation of the password hashing, this is what I am successfully using with VB.NET:

Imports System.Security.Cryptography
Imports System.Text

dim strPassword as string = ... 'Assign this variable to your plain text password
Dim md5 As MD5 = System.Security.Cryptography.MD5.Create()
Dim inputBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(strPassword)
Dim hash As Byte() = md5.ComputeHash(inputBytes)
Dim sb As New StringBuilder()
For i As Integer = 0 To hash.Length - 1
    sb.Append(hash(i).ToString("x2"))
Next
Dim hashtext As [String] = sb.ToString()
While hashtext.Length < 32
    hashtext = "0" & hashtext
End While
'variable hashtext now holds hashed password

I can't remember for sure where I got this (because I originally got it some time ago), but it might have been from Paul Gilbertson.

Rich

Richard Burkmar
Biodiversity Project Officer
Field Studies Council