Re: JWT decoder - Mailing list pgsql-general

From Mladen Gogala
Subject Re: JWT decoder
Date
Msg-id e0675505-b0ad-0da8-7a50-79a2d2faeb82@gmail.com
Whole thread Raw
In response to JWT decoder  (Masih Tavassoli <mtavasso@yahoo.co.uk>)
Responses Re: JWT decoder  (Masih Tavassoli <mtavasso@yahoo.co.uk>)
List pgsql-general

You could probably use Pl/Python. Python has base64 module and urllib module which can deal with all URL strings I am aware of.  Pl/Perl would probably do as well.

On 8/8/21 10:16 PM, Masih Tavassoli wrote:
Hi experts,

I am trying to find a way to decode a URL request header and extract its JSON fields in postgreql .

I can do this in Oracle sql using 

select    (utl_raw.cast_to_varchar2 (utl_encode.base64_decode( utl_raw.cast_to_raw (regexp_replace ( ( 'eyJhbGciOiJSUzI1NiIsImtpZCI6InBhLWFwaS1zaWduIn0.eyJzY29wZSI6W10sInN1YiI6Imp1bGllQHNhcHBoaXJlY29udmV5YW5jaW5nLm5ldC5hdSIsImNsaWVudCI6InB4YV9hY19zZXR0c3BsdXMiLCJ1c2VybmFtZSI6Imp1bGllQHNhcHBoaXJlY29udmV5YW5jaW5nLm5ldC5hdSIsImV4cCI6MTU1NDA4NzU2N30.OZwVETCP+HUDsSkudCfa52eQT2Fyt6BgefFpYr5xpJROjZJeVnXtzsU6MS8aHauqyyOwQSz8iG6OC2YjYgrGiZ8YTwTh1uHptNjicyCFmCkh++d0oGdK78ZOKIAvuslW3GX4V13hPUJADzGLkyO8hy01YF9Id4+7GrvmnRRkwPO7C2eUvKTB8pxDAA94Jpw74s4BiNTmm1Uv+56AXqdI8m2KFkLNwGoUR3OSNvsifl5uxBsGGmP4wbgNe/Dy1q2UsL2eBAW/GuWryHGCRz1/PR2jIV1v21ClQ8YLiFAzM3YxHb8m2ngzRynKof+Nw3nZvuafRQ16MV5THz0ahGFYLA'

), '[[:space:]]', ''))))) from dual



But there doesn't seem to be a way doing it in postgres.

Has anyone got any suggesions?

Thanks
Masih

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

pgsql-general by date:

Previous
From: Masih Tavassoli
Date:
Subject: JWT decoder
Next
From: rob stone
Date:
Subject: Re: JWT decoder