Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Diese Funktion überprüft die Gültigkeit eines Java JSON Web Tokens (JWT).

Argumente

Name

Typ

Beschreibung

 TokenstringVollständiger
Java
JSON Web Token
 PublicKeystring

Öffentlicher Schlüssel, in der Form

R"(-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnDwu1lvzWV0rkD9PDXNW
xVJ5QCcy8AnuRTXiPHqg35+1UYWbsAeiN9FtNeTLuNyspAna7mQgAA3g15SIC+9A
wMIkfiryCyi4pjK281zRI62GRpuabuH9CL56s6u9Om35gM/G33upDlSWRLPLT6pe
/mhGU/g1eQXnSIgInQHouzrUGG5iqENYF8Igm0a0xL1Kx8B4li3MT3uz1W4G5vDa
1eGhO+zcNC2DDeNXh7tqEhWVwF3Oq5acEcSkzIpDAnZ/cMaKlSbFoN/aWHCWqicg
/utKfzdWYkO91OyziQwUYvo6aZtLRv4YXSW4od1/rLe3HSIcXRCMqkd1t5T8fO6M
fBHlm2yOrZ7kdB/f1q23EHh8dxm5j5zkHkExn2YHl+i0J9ntf3iP+tKyfwj+kXLD
SUXwcfbqlMxFJIvVnU6SEdEAhZHAK/e8+XFkIZWBF9imk0SBmwm4u1HImpOhtELF
mfiKCbnIo8TYpu6uDFLYKISC6J09QW6cUNyn83OmtmJjxJ+XLkLslrCnWKo/EFQR
yBmQOHMycZR51Xv9e50s1o/vquR5r8nQkyoLjy77LZJ57jkEZM83+hIkzA0YkUS5
4ka+7Rfvwrg1JsFYlsyQjsu2uCKcwhCxmdvQj+d7fdHqRhw3D2MYRhC3zDnVQHRs
6+fpjRj1pGyXTL/4lPiACYUCAwEAAQ==
-----END PUBLIC KEY-----)"
 IssuerstringDen issuer des Tokens

Rückgabewert 

0 = Der Token ist nicht gültig

1 = Der Token ist gültig

Beispiel

...

Token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczp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u1lvzWV0rkD9PDXNW
xVJ5QCcy8AnuRTXiPHqg35+1UYWbsAeiN9FtNeTLuNyspAna7mQgAA3g15SIC+9A
wMIkfiryCyi4pjK281zRI62GRpuabuH9CL56s6u9Om35gM/G33upDlSWRLPLT6pe
mhGU/g1eQXnSIgInQHouzrUGG5iqENYF8Igm0a0xL1Kx8B4li3MT3uz1W4G5vDa
1eGhO+zcNC2DDeNXh7tqEhWVwF3Oq5acEcSkzIpDAnZ/cMaKlSbFoN/aWHCWqicg
utKfzdWYkO91OyziQwUYvo6aZtLRv4YXSW4od1/rLe3HSIcXRCMqkd1t5T8fO6M
fBHlm2yOrZ7kdB/f1q23EHh8dxm5j5zkHkExn2YHl+i0J9ntf3iP+tKyfwj+kXLD
SUXwcfbqlMxFJIvVnU6SEdEAhZHAK/e8+XFkIZWBF9imk0SBmwm4u1HImpOhtELF
mfiKCbnIo8TYpu6uDFLYKISC6J09QW6cUNyn83OmtmJjxJ+XLkLslrCnWKo/EFQR
yBmQOHMycZR51Xv9e50s1o/vquR5r8nQkyoLjy77LZJ57jkEZM83+hIkzA0YkUS5
4ka+7Rfvwrg1JsFYlsyQjsu2uCKcwhCxmdvQj+d7fdHqRhw3D2MYRhC3zDnVQHRs
6+fpjRj1pGyXTL/4lPiACYUCAwEAAQ==
-----END PUBLIC KEY-----)";

OK = VerifyJWT(Token, PublicKey, "https://oauth.swissmains.net");

Siehe auch

---