NetTalk Central

Recent Posts

Pages: 1 ... 3 4 [5] 6 7 ... 10
41
Web Server - Ask For Help / Re: JWT Json Web Token
« Last post by PaulMacFarlane on November 03, 2024, 11:45:03 PM »
I did not get a compile warning. :-\

Thanks for noticing my error.  Somehow I got it stuck in my brain that it returned a ST object.
42
Web Server - Ask For Help / Re: JWT Json Web Token
« Last post by Bruce on November 03, 2024, 11:00:26 PM »
you probably got a compile warning on this line;

stToEncrypt  = NetMakeHMAC(clip(strPREencrypt ),len(strPREencrypt),CLIP(lSecret),cs:CALG_SHA_256,0)

This line should be
stToEncrypt.SetValu(NetMakeHMAC(clip(strPREencrypt ),len(strPREencrypt),CLIP(lSecret),cs:CALG_SHA_256,0))

just one more reason not to ignore warnings....
43
Web Server - Ask For Help / Left Justify Value of string
« Last post by seanh on November 03, 2024, 06:30:45 PM »
Could we have a checkbox on the validate tab of a field to left justify the field please Bruce?

Reason being I just had a case where client entered a category as '    General' for some reason.
This causes all sorts of problems because the lookup fails on the item assigning the category to, but the actual error is never reported. So it looks like it worked but didn't.

This is not the first time I've come across this.

I'm currently doing a field=LEFT(field) in validateValue  but a checkbox would be way easier :)
44
Web Server - Ask For Help / Re: JWT Json Web Token
« Last post by PaulMacFarlane on November 03, 2024, 06:12:37 PM »
On this section of code:

  stToEncrypt.SetValue(stHeader.GetValue()&'.'&stPayload.GetValue())
  Crypto.MakeHMAC(stToEncrypt,CLIP(lSecret),cs:CALG_SHA_256,0)
  stToEncrypt.Base64Encode(1)
  stToEncrypt.Replace('+','-')
  stToEncrypt.Replace('/','_')
  stToEncrypt.Replace('=','')

I modified per Bruces note to

! NetMakeHMAC function passes a string and returns ST so I created a string for this part
  strPREencrypt = stHeader.GetValue()&'.'&stPayload.GetValue()

  stToEncrypt  = NetMakeHMAC(clip(strPREencrypt ),len(strPREencrypt),CLIP(lSecret),cs:CALG_SHA_256,0)

  stToEncrypt.Base64Encode(1)  <<-GPF
  stToEncrypt.Replace('+','-')
  stToEncrypt.Replace('/','_')
  stToEncrypt.Replace('=','')

And I get a GPF on base64encode.

45
The Rest - Ask For Help / Vapid keys v JWT ?
« Last post by PaulMacFarlane on November 03, 2024, 05:35:33 PM »
Is there a webinar on Vapid keys ?

Per google they are related:
https://blog.mozilla.org/services/2016/04/04/using-vapid-with-webpush/

Could NetGenerateVapidKeys be used to create JWTs ?

All new to me.  Kind of going in circles on this stuff!
46
HI Mike,
Where do you want to make them?  Forms?, Browses?  Anywhere?  Do you want to be more specific?  Do you want to do these in plain Net Talk or do you want to use css?
Ron
47
Can you make CheckBoxes with the Button on the Leftt and Text on the Right ?
48
The Rest - Ask For Help / Example of using JWTs in a web service.....
« Last post by PaulMacFarlane on November 01, 2024, 03:29:06 PM »
Moved this - posted in the wrong section....

I'm probably over thinking this.  I've seen the threads here about constructing JWTs for authentication use....

https://www.nettalkcentral.com/forum/index.php?topic=8902.msg36457#msg36457
https://www.nettalkcentral.com/forum/index.php?topic=8089.msg32855#msg32855

Using the example from Wiki:  https://en.wikipedia.org/wiki/JSON_Web_Token

net.SetValue('grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer')
net.SetValue('assertion',StringContainingtheWholeJWT)
net.Post(urlString)

And I'd get returned values in the page received method:
if Self.ThisPage.Length() > 0
  json.load(resultGroup,self.thispage.GetValuePtr(),self.thispage.Length())
  display()
End

where resultgroup will be....
ResultGroup     GROUP,PRE(result)
access_token    STRING(512)
token_type      STRING(16)
expires_in   long
                END


The service I'm trying to connect to (IRS) requires sending 2 JWTs (for 2 different roles) when connecting.

net.SetValue('grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer')
net.SetValue('assertion',StringContainingtheWholeJWT)
net.SetValue('client_assertion_type','urn:ietf:params:oauth:client-assertion-type:jwt-bearer')
net.SetValue('client_assertion',StringContainingtheWholeJWT)
net.Post(urlString)

Am I thinking this correctly or way off base?  Anyone have an example?
49
Thanks!
This also works perfectly.
50
Web Server - Ask For Help / Re: Tree Control
« Last post by Niels Larsen on October 24, 2024, 10:00:14 PM »
Thanks!
Works perfectly.
Pages: 1 ... 3 4 [5] 6 7 ... 10