Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.14 KB

README.md

File metadata and controls

42 lines (29 loc) · 1.14 KB

JSONWebToken for Pharo

Build Status

Overview

Implementation of a JSON web token following RFC 7519 for Pharo.

Installation

in your Pharo environment (Pharo 6 or higher) evaluate

Metacello new
      baseline:'JSONWebToken';
      repository: 'github://feenkcom/JSONWebToken:0.3.1/source';
      load

Usage

The class JSONWebTokenTest demonstrates how to encode/serialize a web signature to a token string using compact base 64 notation as well as deserialization:

testRoundtrip
	| jws tokenString materialized |
	
	jws := JsonWebSignature new
		algorithmName: 'HS256';
		payload: (JWTClaimsSet new
			at: 'bar' put: 'foo').
	jws key: 'foobar'.
	
	tokenString := jws compactSerialized.
	materialized := JsonWebSignature materializeCompact: tokenString key: 'foobar'.
	self assert: jws equals: materialized

Further Infos