Class: VertxAuthOauth2::ScopeAuthorization

Inherits:
VertxAuthCommon::AuthorizationProvider show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb

Overview

Scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account. An application can request one or more scopes, this information is then presented to the user in the consent screen, and the access token issued to the application will be limited to the scopes granted. The OAuth spec allows the authorization server or user to modify the scopes granted to the application compared to what is requested, although there are not many examples of services doing this in practice. OAuth2 does not define any particular values for scopes, since it is highly dependent on the service's internal architecture and needs.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from VertxAuthCommon::AuthorizationProvider

#get_authorizations, #get_id

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 30

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

+ (::VertxAuthOauth2::ScopeAuthorization) create(scopeSeparator)

Factory method to create a Authorization provider for Oauth 2.0 scopes.

Parameters:

  • scopeSeparator (String)
    the scope separator e.g.: " ", ",", "+"

Returns:



63
64
65
66
67
68
69
70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 63

def self.create(*args)
  if args[0].class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthOauth2Authorization::ScopeAuthorization.java_method(:create, [Java::java.lang.String.java_class]).call(args[0]),::VertxAuthOauth2::ScopeAuthorization)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]})"
  end
end

+ (Object) j_api_type



39
40
41
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 39

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



42
43
44
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 42

def self.j_class
  Java::IoVertxExtAuthOauth2Authorization::ScopeAuthorization.java_class
end

+ (Object) unwrap(obj)



36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 36

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

+ (Object) wrap(obj)



33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 33

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

Instance Method Details

- (String) encode(scopes)

Returns a String with the given scopes concatenated with the given separator.

Parameters:

  • scopes (Array<String>)
    a list of scopes

Returns:

  • (String)
    concatenated string.


49
50
51
52
53
54
55
56
57
58
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 49

def encode(*args)
  if args[0].class == Array && !block_given?
    return @j_del.java_method(:encode, [Java::JavaUtil::List.java_class]).call(args[0].map { |element| element })
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling encode(#{args[0]})"
  end
end

- (String) separator

Returns the configured separator.

Returns:

  • (String)
    the separator.


76
77
78
79
80
81
82
83
84
85
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/scope_authorization.rb', line 76

def separator
  if !block_given?
    return @j_del.java_method(:separator, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling separator()"
  end
end