package modules.jwt.guice.modules

import modules.jwt.decoder.{JwtDecoder, JwtDecoderImpl}
import modules.jwt.encoder.{JwtEncoder, JwtEncoderImpl}
import modules.jwt.validator.{JwtValidator, JwtValidatorImpl}
import net.codingwell.scalaguice.ScalaModule

class JwtModule extends ScalaModule {

  override def configure() {
    bind[JwtEncoder].to[JwtEncoderImpl]
    bind[JwtDecoder].to[JwtDecoderImpl]
    bind[JwtValidator].to[JwtValidatorImpl]
  }
}
package modules.jwt.guice.modules

import com.google.inject.Provides
import com.typesafe.config.Config
import javax.inject.Named
import modules.jwt.decoder.{JwtDecoder, JwtDecoderImpl}
import modules.jwt.encoder.{JwtEncoder, JwtEncoderImpl}
import modules.jwt.validator.{JwtValidator, JwtValidatorImpl}
import net.codingwell.scalaguice.ScalaModule
import pdi.jwt.JwtAlgorithm

class JwtModule extends ScalaModule {

  override def configure() {
    bind[JwtEncoder].to[JwtEncoderImpl]
    bind[JwtDecoder].to[JwtDecoderImpl]
    bind[JwtValidator].to[JwtValidatorImpl]
  }

  @Provides
  def algorithm: JwtAlgorithm = {
    JwtAlgorithm.HS512
  }

  @Provides
  @Named("jwt.secretKey")
  def secretKey(config: Config): String = {
    config.getString("jwt.secretKey")
  }
}
Add injecting JWT secret key and algorithm
Add injecting JWT secret key and algorithm
