Class: VertxAuthMongo::MongoAuth
- Inherits:
-
VertxAuthCommon::AuthProvider
- Object
- VertxAuthCommon::AuthProvider
- VertxAuthMongo::MongoAuth
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb
Overview
An extension of AuthProvider which is using as store
Class Method Summary (collapse)
-
+ (::VertxAuthMongo::MongoAuth) create(mongoClient = nil, config = nil)
Creates an instance of MongoAuth by using the given and configuration object.
Instance Method Summary (collapse)
-
- (String) get_collection_name
The name of the collection used to store User objects inside.
-
- (::VertxAuthMongo::HashStrategy) get_hash_strategy
The HashStrategy which is used by the current instance.
-
- (String) get_password_credential_field
Get the name of the field to be used as property for the password of credentials in the method VertxAuthCommon::AuthProvider#authenticate.
-
- (String) get_password_field
Get the name of the field to be used for the password Defaults to DEFAULT_PASSWORD_FIELD.
-
- (String) get_permission_field
Get the name of the field to be used for the permissions.
-
- (String) get_role_field
Get the name of the field to be used for the roles.
-
- (String) get_salt_field
Get the name of the field to be used for the salt.
-
- (String) get_username_credential_field
Get the name of the field to be used as property for the username in the method VertxAuthCommon::AuthProvider#authenticate.
-
- (String) get_username_field
Get the name of the field to be used for the username.
-
- (void) insert_user(username = nil, password = nil, roles = nil, permissions = nil) { ... }
Insert a new user into mongo in the convenient way.
-
- (self) set_collection_name(collectionName = nil)
Set the name of the collection to be used.
-
- (self) set_hash_strategy(hashStrategy = nil)
The HashStrategy which is used by the current instance.
-
- (self) set_password_credential_field(fieldName = nil)
Set the name of the field to be used as property for the password of credentials in the method VertxAuthCommon::AuthProvider#authenticate.
-
- (self) set_password_field(fieldName = nil)
Set the name of the field to be used for the password Defaults to DEFAULT_PASSWORD_FIELD.
-
- (self) set_permission_field(fieldName = nil)
Set the name of the field to be used for the permissions.
-
- (self) set_role_field(fieldName = nil)
Set the name of the field to be used for the roles.
-
- (self) set_salt_field(fieldName = nil)
Set the name of the field to be used for the salt.
-
- (self) set_username_credential_field(fieldName = nil)
Set the name of the field to be used as property for the username in the method VertxAuthCommon::AuthProvider#authenticate.
-
- (self) set_username_field(fieldName = nil)
Set the name of the field to be used for the username.
Methods inherited from VertxAuthCommon::AuthProvider
Class Method Details
+ (::VertxAuthMongo::MongoAuth) create(mongoClient = nil, config = nil)
Creates an instance of MongoAuth by using the given and configuration object. An example for a
configuration object:
JsonObject js = new JsonObject();
js.put(MongoAuth.PROPERTY_COLLECTION_NAME, createCollectionName(MongoAuth.DEFAULT_COLLECTION_NAME));
30 31 32 33 34 35 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 30 def self.create(mongoClient=nil,config=nil) if mongoClient.class.method_defined?(:j_del) && config.class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthMongo::MongoAuth.java_method(:create, [Java::IoVertxExtMongo::MongoClient.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(mongoClient.j_del,::Vertx::Util::Utils.to_json_object(config)),::VertxAuthMongo::MongoAuth) end raise ArgumentError, "Invalid arguments when calling create(mongoClient,config)" end |
Instance Method Details
- (String) get_collection_name
The name of the collection used to store User objects inside. Defaults to DEFAULT_COLLECTION_NAME
123 124 125 126 127 128 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 123 def get_collection_name if !block_given? return @j_del.java_method(:getCollectionName, []).call() end raise ArgumentError, "Invalid arguments when calling get_collection_name()" end |
- (::VertxAuthMongo::HashStrategy) get_hash_strategy
The HashStrategy which is used by the current instance
202 203 204 205 206 207 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 202 def get_hash_strategy if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getHashStrategy, []).call(),::VertxAuthMongo::HashStrategy) end raise ArgumentError, "Invalid arguments when calling get_hash_strategy()" end |
- (String) get_password_credential_field
Get the name of the field to be used as property for the password of credentials in the method
VertxAuthCommon::AuthProvider#authenticate. Defaults to DEFAULT_CREDENTIAL_PASSWORD_FIELD
175 176 177 178 179 180 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 175 def get_password_credential_field if !block_given? return @j_del.java_method(:getPasswordCredentialField, []).call() end raise ArgumentError, "Invalid arguments when calling get_password_credential_field()" end |
- (String) get_password_field
Get the name of the field to be used for the password Defaults to DEFAULT_PASSWORD_FIELD
139 140 141 142 143 144 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 139 def get_password_field if !block_given? return @j_del.java_method(:getPasswordField, []).call() end raise ArgumentError, "Invalid arguments when calling get_password_field()" end |
- (String) get_permission_field
Get the name of the field to be used for the permissions. Defaults to DEFAULT_PERMISSION_FIELD.
Permissions are expected to be saved as JsonArray
157 158 159 160 161 162 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 157 def if !block_given? return @j_del.java_method(:getPermissionField, []).call() end raise ArgumentError, "Invalid arguments when calling get_permission_field()" end |
- (String) get_role_field
Get the name of the field to be used for the roles. Defaults to DEFAULT_ROLE_FIELD. Roles are expected to
be saved as JsonArray
148 149 150 151 152 153 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 148 def get_role_field if !block_given? return @j_del.java_method(:getRoleField, []).call() end raise ArgumentError, "Invalid arguments when calling get_role_field()" end |
- (String) get_salt_field
Get the name of the field to be used for the salt. Only used when HashStrategy#set_salt_style is
set to
184 185 186 187 188 189 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 184 def get_salt_field if !block_given? return @j_del.java_method(:getSaltField, []).call() end raise ArgumentError, "Invalid arguments when calling get_salt_field()" end |
- (String) get_username_credential_field
Get the name of the field to be used as property for the username in the method
VertxAuthCommon::AuthProvider#authenticate. Defaults to DEFAULT_CREDENTIAL_USERNAME_FIELD
166 167 168 169 170 171 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 166 def get_username_credential_field if !block_given? return @j_del.java_method(:getUsernameCredentialField, []).call() end raise ArgumentError, "Invalid arguments when calling get_username_credential_field()" end |
- (String) get_username_field
Get the name of the field to be used for the username. Defaults to DEFAULT_USERNAME_FIELD
131 132 133 134 135 136 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 131 def get_username_field if !block_given? return @j_del.java_method(:getUsernameField, []).call() end raise ArgumentError, "Invalid arguments when calling get_username_field()" end |
- (void) insert_user(username = nil, password = nil, roles = nil, permissions = nil) { ... }
This method returns an undefined value.
Insert a new user into mongo in the convenient way
215 216 217 218 219 220 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 215 def insert_user(username=nil,password=nil,roles=nil,=nil) if username.class == String && password.class == String && roles.class == Array && .class == Array && block_given? return @j_del.java_method(:insertUser, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(username,password,roles.map { |element| element },.map { |element| element },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) })) end raise ArgumentError, "Invalid arguments when calling insert_user(username,password,roles,permissions)" end |
- (self) set_collection_name(collectionName = nil)
Set the name of the collection to be used. Defaults to DEFAULT_COLLECTION_NAME
39 40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 39 def set_collection_name(collectionName=nil) if collectionName.class == String && !block_given? @j_del.java_method(:setCollectionName, [Java::java.lang.String.java_class]).call(collectionName) return self end raise ArgumentError, "Invalid arguments when calling set_collection_name(collectionName)" end |
- (self) set_hash_strategy(hashStrategy = nil)
The HashStrategy which is used by the current instance
193 194 195 196 197 198 199 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 193 def set_hash_strategy(hashStrategy=nil) if hashStrategy.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:setHashStrategy, [Java::IoVertxExtAuthMongo::HashStrategy.java_class]).call(hashStrategy.j_del) return self end raise ArgumentError, "Invalid arguments when calling set_hash_strategy(hashStrategy)" end |
- (self) set_password_credential_field(fieldName = nil)
Set the name of the field to be used as property for the password of credentials in the method
VertxAuthCommon::AuthProvider#authenticate. Defaults to DEFAULT_CREDENTIAL_PASSWORD_FIELD
103 104 105 106 107 108 109 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 103 def set_password_credential_field(fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setPasswordCredentialField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_password_credential_field(fieldName)" end |
- (self) set_password_field(fieldName = nil)
Set the name of the field to be used for the password Defaults to DEFAULT_PASSWORD_FIELD
59 60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 59 def set_password_field(fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setPasswordField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_password_field(fieldName)" end |
- (self) set_permission_field(fieldName = nil)
Set the name of the field to be used for the permissions. Defaults to DEFAULT_PERMISSION_FIELD.
Permissions are expected to be saved as JsonArray
81 82 83 84 85 86 87 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 81 def (fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setPermissionField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_permission_field(fieldName)" end |
- (self) set_role_field(fieldName = nil)
Set the name of the field to be used for the roles. Defaults to DEFAULT_ROLE_FIELD. Roles are expected to
be saved as JsonArray
70 71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 70 def set_role_field(fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setRoleField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_role_field(fieldName)" end |
- (self) set_salt_field(fieldName = nil)
Set the name of the field to be used for the salt. Only used when HashStrategy#set_salt_style is
set to
114 115 116 117 118 119 120 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 114 def set_salt_field(fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setSaltField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_salt_field(fieldName)" end |
- (self) set_username_credential_field(fieldName = nil)
Set the name of the field to be used as property for the username in the method
VertxAuthCommon::AuthProvider#authenticate. Defaults to DEFAULT_CREDENTIAL_USERNAME_FIELD
92 93 94 95 96 97 98 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 92 def set_username_credential_field(fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setUsernameCredentialField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_username_credential_field(fieldName)" end |
- (self) set_username_field(fieldName = nil)
Set the name of the field to be used for the username. Defaults to DEFAULT_USERNAME_FIELD
49 50 51 52 53 54 55 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-mongo/mongo_auth.rb', line 49 def set_username_field(fieldName=nil) if fieldName.class == String && !block_given? @j_del.java_method(:setUsernameField, [Java::java.lang.String.java_class]).call(fieldName) return self end raise ArgumentError, "Invalid arguments when calling set_username_field(fieldName)" end |