mirror of
				https://github.com/arcan1s/ffxivbis.git
				synced 2025-11-04 07:03:41 +00:00 
			
		
		
		
	fix auth generation and blocked https->http requests
This commit is contained in:
		@ -50,6 +50,7 @@ me.arcanis.ffxivbis {
 | 
			
		||||
        #hostname = "127.0.0.1:8000"
 | 
			
		||||
        # enable head requests for GET requests
 | 
			
		||||
        enable-head-requests = yes
 | 
			
		||||
        schemes = ["http"]
 | 
			
		||||
 | 
			
		||||
        authorization-cache {
 | 
			
		||||
            # maximum amount of cached logins
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@ import com.typesafe.config.Config
 | 
			
		||||
import io.swagger.v3.oas.models.security.SecurityScheme
 | 
			
		||||
 | 
			
		||||
import scala.io.Source
 | 
			
		||||
import scala.jdk.CollectionConverters._
 | 
			
		||||
 | 
			
		||||
class Swagger(config: Config) extends SwaggerHttpService {
 | 
			
		||||
 | 
			
		||||
@ -38,12 +39,14 @@ class Swagger(config: Config) extends SwaggerHttpService {
 | 
			
		||||
    if (config.hasPath("me.arcanis.ffxivbis.web.hostname")) config.getString("me.arcanis.ffxivbis.web.hostname")
 | 
			
		||||
    else s"${config.getString("me.arcanis.ffxivbis.web.host")}:${config.getInt("me.arcanis.ffxivbis.web.port")}"
 | 
			
		||||
 | 
			
		||||
  override val schemes: List[String] = config.getStringList("me.arcanis.ffxivbis.web.schemes").asScala.toList
 | 
			
		||||
 | 
			
		||||
  private val basicAuth = new SecurityScheme()
 | 
			
		||||
    .description("basic http auth")
 | 
			
		||||
    .`type`(SecurityScheme.Type.HTTP)
 | 
			
		||||
    .in(SecurityScheme.In.HEADER)
 | 
			
		||||
    .scheme("basic")
 | 
			
		||||
  override val securitySchemes: Map[String, SecurityScheme] = Map("auth" -> basicAuth)
 | 
			
		||||
  override val securitySchemes: Map[String, SecurityScheme] = Map("basic" -> basicAuth)
 | 
			
		||||
 | 
			
		||||
  override val unwantedDefinitions: Seq[String] =
 | 
			
		||||
    Seq("Function1", "Function1RequestContextFutureRouteResult")
 | 
			
		||||
 | 
			
		||||
@ -79,7 +79,7 @@ class BiSEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
 | 
			
		||||
    tags = Array("best in slot"),
 | 
			
		||||
  )
 | 
			
		||||
  def createBiS: Route =
 | 
			
		||||
@ -140,7 +140,7 @@ class BiSEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("best in slot"),
 | 
			
		||||
  )
 | 
			
		||||
  def getBiS: Route =
 | 
			
		||||
@ -197,7 +197,7 @@ class BiSEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
 | 
			
		||||
    tags = Array("best in slot"),
 | 
			
		||||
  )
 | 
			
		||||
  def modifyBiS: Route =
 | 
			
		||||
 | 
			
		||||
@ -81,7 +81,7 @@ class LootEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("loot"),
 | 
			
		||||
  )
 | 
			
		||||
  def getLoot: Route =
 | 
			
		||||
@ -137,7 +137,7 @@ class LootEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
 | 
			
		||||
    tags = Array("loot"),
 | 
			
		||||
  )
 | 
			
		||||
  def modifyLoot: Route =
 | 
			
		||||
@ -202,7 +202,7 @@ class LootEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("loot"),
 | 
			
		||||
  )
 | 
			
		||||
  def suggestLoot: Route =
 | 
			
		||||
 | 
			
		||||
@ -73,7 +73,7 @@ class PartyEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("party"),
 | 
			
		||||
  )
 | 
			
		||||
  def getPartyDescription: Route =
 | 
			
		||||
@ -126,7 +126,7 @@ class PartyEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
 | 
			
		||||
    tags = Array("party"),
 | 
			
		||||
  )
 | 
			
		||||
  def modifyPartyDescription: Route =
 | 
			
		||||
 | 
			
		||||
@ -85,7 +85,7 @@ class PlayerEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("party"),
 | 
			
		||||
  )
 | 
			
		||||
  def getParty: Route =
 | 
			
		||||
@ -146,7 +146,7 @@ class PlayerEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("party"),
 | 
			
		||||
  )
 | 
			
		||||
  def getPartyStats: Route =
 | 
			
		||||
@ -202,7 +202,7 @@ class PlayerEndpoint(
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
 | 
			
		||||
    tags = Array("party"),
 | 
			
		||||
  )
 | 
			
		||||
  def modifyParty: Route =
 | 
			
		||||
 | 
			
		||||
@ -126,7 +126,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("admin"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("admin"))),
 | 
			
		||||
    tags = Array("users"),
 | 
			
		||||
  )
 | 
			
		||||
  def createUser: Route =
 | 
			
		||||
@ -172,7 +172,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("admin"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("admin"))),
 | 
			
		||||
    tags = Array("users"),
 | 
			
		||||
  )
 | 
			
		||||
  def deleteUser: Route =
 | 
			
		||||
@ -223,7 +223,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
 | 
			
		||||
    tags = Array("users"),
 | 
			
		||||
  )
 | 
			
		||||
  def getUsers: Route =
 | 
			
		||||
@ -270,7 +270,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
 | 
			
		||||
        content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
 | 
			
		||||
      ),
 | 
			
		||||
    ),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("admin"))),
 | 
			
		||||
    security = Array(new SecurityRequirement(name = "basic", scopes = Array("admin"))),
 | 
			
		||||
    tags = Array("users"),
 | 
			
		||||
  )
 | 
			
		||||
  def getUsersCurrent: Route =
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user