1.0.0 • Published 5 months ago

decodesapsso2 v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

SAPSSO2 decoder

This decodes MYSAPSSO2 tickets, does not validate them or attempt

The decoded ticket will look like:

{
  "version": 2,
  "id": "4103",
  "fields": {
    "username": "DEVELOPER   ",
    "client": "001",
    "system": "A4H     ",
    "issueTime": "202502251038",
    "validityhours": 8,
    "Signature": "MIH4BgkqhkiG9w..."
  }
}

The signature is not validated, just exposed as a base64 encoded string

Example usage

import { Validation } from "io-ts"
import { decodeSAPSSO2, tryDecodeSAPSSO2, SAPSSO2Ticket, startTime, expirationTime } from "decodesapsso2"

const rawticket = "" // a base64 ticket, usually found as MYSAPSSO2 cookie in a browser session

// Either an error or a decoded ticker
const ticketValidation: Validation<SAPSSO2Ticket> = tryDecodeSAPSSO2(rawticket)

// a ticket, throws on error
const ticket: SAPSSO2Ticket = decodeSAPSSO2(rawticket)

const ticketStartTime: Date = startTime(ticket)

const ticketExpiration: Date = expirationTime(ticket)

License

This is released under the MIT license

1.0.0

5 months ago