Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A JWT library for scala 3

License

NotificationsYou must be signed in to change notification settings

vlmiroshnikov/authz

Repository files navigation

Latest versionLatest version

Install

libraryDependencies += "io.github.vlmiroshnikov" %% "authz-core" % "<version>" libraryDependencies += "io.github.vlmiroshnikov" %% "authz-circe" % "<version>" //  marshalling with circe

Example

import cats.syntax.all.*import cats.effect.*import io.github.vlmiroshnikov.authz.jwt.{given, *}import io.github.vlmiroshnikov.authz.jwt.impl.RS256import io.github.vlmiroshnikov.authz.jwt.circe.{given, *}import io.github.vlmiroshnikov.authz.utils.*object SimpleApp extends IOApp.Simple {  def run: IO[Unit] = {        val keyPair = JCAHelper.generateRSAKeyPair     given s: Signer[IO]   = RS256.signer[IO](keyPair.getPrivate())    given v: Verifier[IO] = RS256.verifier[IO](keyPair.getPublic())    for      jwt <- buildAndSign[IO, StdHeader, StdClaims](StdHeader(algorithm = v.algo.name), StdClaims())      _   <- IO.println(jwt.show)      res <- parse[IO, StdHeader, StdClaims](jwt.show)      v   <- verify[IO, StdHeader, StdClaims](res.header, res.claims, res.signature, res.signedPart)      _   <- IO.println(res.toString)      _   <- IO.println("Result: " + v.show)    yield ()  }}

Dependencies

  • scala 3.1.0
  • cats 2.7.0
  • apache common-codecs 1.15
  • circe 0.14.1

[8]ページ先頭

©2009-2025 Movatter.jp