Class: Identikey::Administration

Inherits:
Base
  • Object
show all
Defined in:
lib/identikey/administration.rb,
lib/identikey/administration/user.rb,
lib/identikey/administration/session.rb,
lib/identikey/administration/digipass.rb,
lib/identikey/administration/session_query.rb

Overview

This class wraps the Administration API wsdl, that contains dozens of methods. It is currently monolithic.

It’s the lower level into the Administration API, while its models are wrapped in separate clasess.

Defined Under Namespace

Classes: Digipass, Session, SessionQuery, User

Constant Summary

Constants inherited from Base

Base::DEFAULTS

Instance Method Summary collapse

Methods inherited from Base

client, configure, default_user_agent_header, #endpoint, identikey_filter_proc_for, process_identikey_filters, #wsdl

Instance Method Details

#admin_session_query(session_id:) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/identikey/administration.rb', line 71

def admin_session_query(session_id:)
  attributes = [ ]

  # These doesn't seem to work as described by the WSDL.
  # if q_idx
  #   attributes.push(attributeID: 'ADMINSESSIONFLD_SESSION_IDX',
  #                   value: { '@xsi:type': 'xsd:string', content!: q_idx})
  # end

  # if q_location
  #   attributes.push(attributeID: 'ADMINSESSIONFLD_LOCATION',
  #                   value: { '@xsi:type': 'xsd:string', content!: q_location})
  # end

  # if q_username
  #   attributes.push(attributeID: 'ADMINSESSIONFLD_LOGIN_NAME',
  #                   value: { '@xsi:type': 'xsd:string', content!: q_username})
  # end

  resp = super(message: {
    sessionID: session_id,
    attributeSet: {
      attributes: attributes
    }
    # fieldSet: { ... }
    # queryOptions: { ... }
  })

  parse_response resp, :admin_session_query_response
end

#digipass_execute(session_id:, cmd:, attributes: []) ⇒ Object

DIGIPASS_EXECUTE



218
219
220
221
222
223
224
225
226
227
228
# File 'lib/identikey/administration.rb', line 218

def digipass_execute(session_id:, cmd:, attributes: [])
  resp = super(message: {
    sessionID: session_id,
    cmd: cmd,
    attributeSet: {
      attributes: attributes
    }
  })

  parse_response resp, :digipass_execute_response
end

#digipass_execute_ASSIGN(session_id:, serial_no:, username:, domain:, grace_period: 0) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/identikey/administration.rb', line 250

def digipass_execute_ASSIGN(session_id:, serial_no:, username:, domain:, grace_period: 0)
  digipass_execute(
    session_id: session_id,
    cmd: 'DIGIPASSCMD_ASSIGN',
    attributes: typed_attributes_list_from(
      DIGIPASSFLD_SERNO: serial_no,
      DIGIPASSFLD_ASSIGNED_USERID: username,
      DIGIPASSFLD_DOMAIN: domain,
      DIGIPASSFLD_GRACE_PERIOD_DAYS: grace_period
    )
  )
end

#digipass_execute_UNASSIGN(session_id:, serial_no:) ⇒ Object



240
241
242
243
244
245
246
247
248
# File 'lib/identikey/administration.rb', line 240

def digipass_execute_UNASSIGN(session_id:, serial_no:)
  digipass_execute(
    session_id: session_id,
    cmd: 'DIGIPASSCMD_UNASSIGN',
    attributes: typed_attributes_list_from(
      DIGIPASSFLD_SERNO: serial_no
    )
  )
end

#digipass_execute_VIEW(session_id:, serial_no:) ⇒ Object



230
231
232
233
234
235
236
237
238
# File 'lib/identikey/administration.rb', line 230

def digipass_execute_VIEW(session_id:, serial_no:)
  digipass_execute(
    session_id: session_id,
    cmd: 'DIGIPASSCMD_VIEW',
    attributes: typed_attributes_list_from(
      DIGIPASSFLD_SERNO: serial_no
    )
  )
end

#digipass_query(session_id:, attributes:, query_options:) ⇒ Object

DIGIPASS_QUERY



267
268
269
270
271
272
273
274
275
276
277
# File 'lib/identikey/administration.rb', line 267

def digipass_query(session_id:, attributes:, query_options:)
  resp = super(message: {
    sessionID: session_id,
    attributeSet: {
      attributes: typed_attributes_query_list_from(attributes)
    },
    queryOptions: query_options
  })

  parse_response resp, :digipass_query_response
end

#digipassappl_execute(session_id:, cmd:, attributes:) ⇒ Object

DIGIPASSAPPL_EXECUTE



283
284
285
286
287
288
289
290
291
292
293
# File 'lib/identikey/administration.rb', line 283

def digipassappl_execute(session_id:, cmd:, attributes:)
  resp = super(message: {
    sessionID: session_id,
    cmd: cmd,
    attributeSet: {
      attributes: attributes
    }
  })

  parse_response resp, :digipassappl_execute_response
end

#digipassappl_execute_SET_PIN(session_id:, serial_no:, appl:, pin:) ⇒ Object



307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/identikey/administration.rb', line 307

def digipassappl_execute_SET_PIN(session_id:, serial_no:, appl:, pin:)
  digipassappl_execute(
    session_id: session_id,
    cmd: 'DIGIPASSAPPLCMD_SET_PIN',
    attributes: typed_attributes_list_from(
      DIGIPASSAPPLFLD_SERNO: serial_no,
      DIGIPASSAPPLFLD_APPL_NAME: appl,
      DIGIPASSAPPLFLD_NEW_PIN: pin,
      DIGIPASSAPPLFLD_NEW_PIN_CONF: pin
    )
  )
end

#digipassappl_execute_TEST_OTP(session_id:, serial_no:, appl:, otp:) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
# File 'lib/identikey/administration.rb', line 295

def digipassappl_execute_TEST_OTP(session_id:, serial_no:, appl:, otp:)
  digipassappl_execute(
    session_id: session_id,
    cmd: 'DIGIPASSAPPLCMD_TEST_OTP',
    attributes: typed_attributes_list_from(
      DIGIPASSAPPLFLD_SERNO: serial_no,
      DIGIPASSAPPLFLD_APPL_NAME: appl,
      DIGIPASSAPPLFLD_RESPONSE: otp
    )
  )
end

#logoff(session_id:) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/identikey/administration.rb', line 40

def logoff(session_id:)
  resp = super(message: {
    attributeSet: {
      attributes: typed_attributes_list_from(
        CREDFLD_SESSION_ID: session_id
      )
    }
  })

  parse_response resp, :logoff_response
end

#logon(username:, password:, domain:) ⇒ Object

LOGON/LOGOFF/PING



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/identikey/administration.rb', line 25

def logon(username:, password:, domain:)
  resp = super(message: {
    attributeSet: {
      attributes: typed_attributes_list_from(
        CREDFLD_DOMAIN:          domain,
        CREDFLD_PASSWORD:        password,
        CREDFLD_USERID:          username,
        CREDFLD_PASSWORD_FORMAT: Unsigned(0)
      )
    }
  })

  parse_response resp, :logon_response
end

#ping(session_id:, log:) ⇒ Object

Like sessionalive, but allows to disable logging if the ‘log:` keyword is set to false.



67
68
69
# File 'lib/identikey/administration.rb', line 67

def ping(session_id:, log:)
  logging_to(log) { sessionalive(session_id: session_id) }
end

#sessionalive(session_id:) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/identikey/administration.rb', line 52

def sessionalive(session_id:)
  resp = super(message: {
    attributeSet: {
      attributes: typed_attributes_list_from(
        CREDFLD_SESSION_ID: session_id
      )
    }
  })

  parse_response resp, :sessionalive_response
end

#user_execute(session_id:, cmd:, attributes: []) ⇒ Object

USER_EXECUTE



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/identikey/administration.rb', line 106

def user_execute(session_id:, cmd:, attributes: [])
  resp = super(message: {
    sessionID: session_id,
    cmd: cmd,
    attributeSet: {
      attributes: attributes
    }
  })

  parse_response resp, :user_execute_response
end

#user_execute_CREATE(session_id:, attributes:) ⇒ Object



129
130
131
132
133
134
135
# File 'lib/identikey/administration.rb', line 129

def user_execute_CREATE(session_id:, attributes:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_CREATE',
    attributes: typed_attributes_list_from(attributes)
  )
end

#user_execute_DELETE(session_id:, username:, domain:) ⇒ Object



145
146
147
148
149
150
151
152
153
154
# File 'lib/identikey/administration.rb', line 145

def user_execute_DELETE(session_id:, username:, domain:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_DELETE',
    attributes: typed_attributes_list_from(
      USERFLD_USERID: username,
      USERFLD_DOMAIN: domain
    )
  )
end

#user_execute_RESET_PASSWORD(session_id:, username:, domain:) ⇒ Object



156
157
158
159
160
161
162
163
164
165
# File 'lib/identikey/administration.rb', line 156

def user_execute_RESET_PASSWORD(session_id:, username:, domain:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_RESET_PASSWORD',
    attributes: typed_attributes_list_from(
      USERFLD_USERID: username,
      USERFLD_DOMAIN: domain
    )
  )
end

#user_execute_SET_PASSWORD(session_id:, username:, domain:, password:) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/identikey/administration.rb', line 167

def user_execute_SET_PASSWORD(session_id:, username:, domain:, password:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_SET_PASSWORD',
    attributes: typed_attributes_list_from(
      USERFLD_USERID: username,
      USERFLD_DOMAIN: domain,
      USERFLD_NEW_PASSWORD: password,
      USERFLD_CONFIRM_NEW_PASSWORD: password
    )
  )
end

#user_execute_UNLOCK(session_id:, username:, domain:) ⇒ Object



180
181
182
183
184
185
186
187
188
189
# File 'lib/identikey/administration.rb', line 180

def user_execute_UNLOCK(session_id:, username:, domain:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_UNLOCK',
    attributes: typed_attributes_list_from(
      USERFLD_USERID: username,
      USERFLD_DOMAIN: domain
    )
  )
end

#user_execute_UPDATE(session_id:, attributes:) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/identikey/administration.rb', line 137

def user_execute_UPDATE(session_id:, attributes:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_UPDATE',
    attributes: typed_attributes_list_from(attributes)
  )
end

#user_execute_VIEW(session_id:, username:, domain:) ⇒ Object



118
119
120
121
122
123
124
125
126
127
# File 'lib/identikey/administration.rb', line 118

def user_execute_VIEW(session_id:, username:, domain:)
  user_execute(
    session_id: session_id,
    cmd: 'USERCMD_VIEW',
    attributes: typed_attributes_list_from(
      USERFLD_USERID: username,
      USERFLD_DOMAIN: domain
    )
  )
end

#user_query(session_id:, attributes:, query_options:, log: false) ⇒ Object

Executes a userQuery command that searches users. By default, it doesn’t log anywhere. To enable logging to a specific destination, pass a logger as the log: option. To log to the default destination, pass ‘true` as the log: option.



200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/identikey/administration.rb', line 200

def user_query(session_id:, attributes:, query_options:, log: false)
  logging_to(log) do
    resp = super(message: {
      sessionID: session_id,
      attributeSet: {
        attributes: typed_attributes_query_list_from(attributes)
      },
      queryOptions: query_options
    })

    parse_response resp, :user_query_response
  end
end