Class List Method List File List

# Class: VertxWeb::JWTAuthHandler

Inherits:
  Object
  - Object
  - VertxWeb::JWTAuthHandler
  show all
Includes:
  AuthHandler
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb

## Overview

An auth handler that provides JWT Authentication support.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::JWTAuthHandler) create(authProvider = nil, skip = nil)
  Create a JWT auth handler.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (self) add_authorities(authorities = nil)
  Add a set of required authorities for this auth handler.
- - (self) add_authority(authority = nil)
  Add a required authority for this auth handler.
- - (void) handle(arg0 = nil)
- - (self) set_audience(audience = nil)
  Set the audience list.
- - (self) set_ignore_expiration(ignoreExpiration = nil)
  Set whether expiration is ignored.
- - (self) set_issuer(issuer = nil)
  Set the issuer.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 21

    def @@j_api_type.accept?(obj)
      obj.class == JWTAuthHandler
    end

### + (`::VertxWeb::JWTAuthHandler`) create(authProvider = nil, skip = nil)

Create a JWT auth handler

Parameters:

- authProvider (`::VertxAuthJwt::JWTAuth`) (defaults to: `nil`) —
  the auth provider to use.
- skip (`String`) (defaults to: `nil`)

Returns:

- (`::VertxWeb::JWTAuthHandler`) —
  the auth handler

Raises:

- (`ArgumentError`)

    68
    69
    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 68

    def self.create(authProvider=nil,skip=nil)
      if authProvider.class.method_defined?(:j_del) && !block_given? && skip == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::JWTAuthHandler.java_method(:create, [Java::IoVertxExtAuthJwt::JWTAuth.java_class]).call(authProvider.j_del),::VertxWeb::JWTAuthHandler)
      elsif authProvider.class.method_defined?(:j_del) && skip.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::JWTAuthHandler.java_method(:create, [Java::IoVertxExtAuthJwt::JWTAuth.java_class,Java::java.lang.String.java_class]).call(authProvider.j_del,skip),::VertxWeb::JWTAuthHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{authProvider},#{skip})"
    end

### + (`Object`) j_api_type

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 30

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 33

    def self.j_class
      Java::IoVertxExtWebHandler::JWTAuthHandler.java_class
    end

### + (`Object`) unwrap(obj)

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 27

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 24

    def @@j_api_type.wrap(obj)
      JWTAuthHandler.new(obj)
    end

## Instance Method Details

### - (`self`) add_authorities(authorities = nil)

Add a set of required authorities for this auth handler

Parameters:

- authorities (`Set<String>`) (defaults to: `nil`) —
  the set of authorities

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    57
    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 57

    def add_authorities(authorities=nil)
      if authorities.class == Set && !block_given?
        @j_del.java_method(:addAuthorities, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(authorities.map { |element| element }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling add_authorities(#{authorities})"
    end

### - (`self`) add_authority(authority = nil)

Add a required authority for this auth handler

Parameters:

- authority (`String`) (defaults to: `nil`) —
  the authority

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 47

    def add_authority(authority=nil)
      if authority.class == String && !block_given?
        @j_del.java_method(:addAuthority, [Java::java.lang.String.java_class]).call(authority)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling add_authority(#{authority})"
    end

### - (`void`) handle(arg0 = nil)

This method returns an undefined value.

Parameters:

- arg0 (`::VertxWeb::RoutingContext`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 38

    def handle(arg0=nil)
      if arg0.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(arg0.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle(#{arg0})"
    end

### - (`self`) set_audience(audience = nil)

Set the audience list

Parameters:

- audience (`Array<String>`) (defaults to: `nil`) —
  the audience list

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 79

    def set_audience(audience=nil)
      if audience.class == Array && !block_given?
        @j_del.java_method(:setAudience, [Java::JavaUtil::List.java_class]).call(audience.map { |element| element })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_audience(#{audience})"
    end

### - (`self`) set_ignore_expiration(ignoreExpiration = nil)

Set whether expiration is ignored

Parameters:

- ignoreExpiration (`true`, `false`) (defaults to: `nil`) —
  whether expiration is ignored

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    99
    100
    101
    102
    103
    104
    105
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 99

    def set_ignore_expiration(ignoreExpiration=nil)
      if (ignoreExpiration.class == TrueClass || ignoreExpiration.class == FalseClass) && !block_given?
        @j_del.java_method(:setIgnoreExpiration, [Java::boolean.java_class]).call(ignoreExpiration)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_ignore_expiration(#{ignoreExpiration})"
    end

### - (`self`) set_issuer(issuer = nil)

Set the issuer

Parameters:

- issuer (`String`) (defaults to: `nil`) —
  the issuer

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    89
    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/jwt_auth_handler.rb', line 89

    def set_issuer(issuer=nil)
      if issuer.class == String && !block_given?
        @j_del.java_method(:setIssuer, [Java::java.lang.String.java_class]).call(issuer)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_issuer(#{issuer})"
    end