;; disfluid, implementation of the Solid specification ;; Copyright (C) 2021 Vivien Kraus ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as ;; published by the Free Software Foundation, either version 3 of the ;; License, or (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU Affero General Public License for more details. ;; You should have received a copy of the GNU Affero General Public License ;; along with this program. If not, see . (use-modules (webid-oidc client accounts) (webid-oidc jwk) (webid-oidc oidc-id-token) (sxml simple) (webid-oidc testing) (webid-oidc serializable) (web uri) (oop goops)) (define (xml->account xml) (call-with-input-string xml read/xml)) (with-test-environment "xml-accounts" (lambda () (let ((account-xml " ") (account (make #:subject (string->uri "https://example.com/profile/card#me") #:issuer (string->uri "https://example.com") #:access-token "xxx" #:refresh-token "xxx" #:id-token (make #:alg 'RS256 #:webid (string->uri "https://example.com/profile/card#me") #:iss (string->uri "https://example.com") #:sub "toto" #:aud (string->uri "https://client.example.com/app-id") #:iat 0 #:exp 3600 #:nonce "xxxxx") #:key-pair (make #:public-key (make #:n "zopuG9oxFDbs6dntfGBBm6F1tU4Cy80lWpMOL3Je1ks9RHixn8_vlswdW-YM_jUdfhdH4VdQ5ergV2flOtTZ3agVGxMZWtdS8WxKNkmeyr1mVchRB7Hzl1kLYWClkBeoQ2Bi3vDCxTsdz9q3x7610wnRbcAHhtxq_Wm4vlYqXm7MJ5eMXzAdkNaBMgjt38fbOssH8vXqq57nvIZ2kyjAW_cvPixEQR3w6Py_nBzElJDgDO59x9SsRbVn_5qpqPK9vi4RPpKmIVpT3ww_ChJjZZHRYWbKmVyX15xfSRK0zQBtbbYVxqwZyUx8lkxoNKSXkcwcPdumqrYekzMx8eiaFQ" #:e "AQAB") #:private-key (make #:d "HGhh2KbcFUGwuEFnLrI2k-dTP0qpi8p9lsWfL9t1O9hBZweKtsZs17rfVuJ_av93PP6Kvm26DMWPcbY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cn84Mmr-sJRcqoesECsABcosn0EH8IrKpuiZniGcNXh1kC5UlmyvPjOlEJhXuNPwk38"))))) (let ((parsed-once (xml->account account-xml)) (printed-once (call-with-output-string (lambda (port) (sxml->xml (->sxml account) port))))) (let ((parsed-twice (xml->account printed-once)) (printed-twice (call-with-output-string (lambda (port) (sxml->xml (->sxml parsed-once) port))))) (let ((parsed-thrice (xml->account printed-twice)) (printed-thrice (call-with-output-string (lambda (port) (sxml->xml (->sxml parsed-twice) port))))) (unless (and (equal? parsed-once account) (equal? parsed-twice parsed-once) (equal? parsed-thrice parsed-twice) (equal? printed-twice printed-once) (equal? printed-thrice printed-twice)) (exit 1))))))))