Sha256: 4325d955470db3e4719105acdc340dfb41052e233e9633797196efd241acf0b8

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

require 'async'
require 'vaas/client_credentials_grant_authenticator'
require 'vaas/vaas_main'

CLIENT_ID = ENV.fetch('CLIENT_ID')
CLIENT_SECRET = ENV.fetch('CLIENT_SECRET')
PATHS = ENV.fetch('PATHS')

def main
  authenticator = VAAS::ClientCredentialsGrantAuthenticator.new(
    CLIENT_ID,
    CLIENT_SECRET,
    "https://keycloak-vaas.gdatasecurity.de/realms/vaas/protocol/openid-connect/token"
  )

  # create a vaas object and get a token to authenticate
  vaas = VAAS::VaasMain.new
  token = authenticator.get_token

  Async do
    # wait to connect and authenticate
    Async { vaas.connect(token) }.wait

    # simple loop to get the verdict of a list of files
    PATHS.each do |file|
      verdict = vaas.for_file(file)
      puts "Verdict #{verdict.sha256} is detected as #{verdict.verdict}"
    end

  ensure
    vaas.close
  end
end

if __FILE__  == $0
  main
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vaas-1.0.1 examples/example_with_lists.rb