Class: Infrawrench::ProfileMfaNamespace
- Inherits:
-
Object
- Object
- Infrawrench::ProfileMfaNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.profile.mfa
Instance Method Summary collapse
-
#challenge(factor_id:, request_options: nil) ⇒ Hash
Issue a fresh challenge for a factor.
-
#create(request_options: nil) ⇒ Hash
Begin TOTP enrolment.
-
#delete(factor_id:, request_options: nil) ⇒ Hash
Remove an authentication factor.
-
#initialize(transport) ⇒ ProfileMfaNamespace
constructor
private
A new instance of ProfileMfaNamespace.
-
#list(request_options: nil) ⇒ Array<Hash>
List enrolled authentication factors.
-
#verify(factor_id:, body: nil, request_options: nil) ⇒ Hash
Verify a code against a challenge.
Constructor Details
#initialize(transport) ⇒ ProfileMfaNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ProfileMfaNamespace.
2255 2256 2257 |
# File 'lib/infrawrench/client.rb', line 2255 def initialize(transport) @transport = transport end |
Instance Method Details
#challenge(factor_id:, request_options: nil) ⇒ Hash
Issue a fresh challenge for a factor
POST /api/profile/mfa/factorId/challenge
Raises on 401: Unauthenticated
Raises on 404: Not found
2271 2272 2273 2274 2275 2276 2277 2278 |
# File 'lib/infrawrench/client.rb', line 2271 def challenge(factor_id:, request_options: nil) @transport.request( http_method: "POST", path: "/api/profile/mfa/{factorId}/challenge", path_params: { "factorId" => factor_id }, request_options: ) end |
#create(request_options: nil) ⇒ Hash
Begin TOTP enrolment
Creates the factor and a first challenge. The factor only becomes usable
once a code is verified; abandon the flow by DELETEing the returned
factorId.
POST /api/profile/mfa
Raises on 401: Unauthenticated
Raises on 403: Recent sign-in required. Send the user through sign-in again and retry; the request itself was well-formed.
2296 2297 2298 2299 2300 2301 2302 |
# File 'lib/infrawrench/client.rb', line 2296 def create(request_options: nil) @transport.request( http_method: "POST", path: "/api/profile/mfa", request_options: ) end |
#delete(factor_id:, request_options: nil) ⇒ Hash
Remove an authentication factor
DELETE /api/profile/mfa/factorId
Raises on 401: Unauthenticated
Raises on 403: Recent sign-in required. Send the user through sign-in again and retry; the request itself was well-formed.
Raises on 404: Not found
2319 2320 2321 2322 2323 2324 2325 2326 |
# File 'lib/infrawrench/client.rb', line 2319 def delete(factor_id:, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/profile/mfa/{factorId}", path_params: { "factorId" => factor_id }, request_options: ) end |
#list(request_options: nil) ⇒ Array<Hash>
List enrolled authentication factors
Includes factors whose enrolment was never confirmed — WorkOS does not expose a verified flag.
GET /api/profile/mfa
Raises on 401: Unauthenticated
2341 2342 2343 2344 2345 2346 2347 |
# File 'lib/infrawrench/client.rb', line 2341 def list(request_options: nil) @transport.request( http_method: "GET", path: "/api/profile/mfa", request_options: ) end |
#verify(factor_id:, body: nil, request_options: nil) ⇒ Hash
Verify a code against a challenge
POST /api/profile/mfa/factorId/verify
Raises on 400: Bad request
Raises on 401: Unauthenticated
Raises on 404: Not found
2364 2365 2366 2367 2368 2369 2370 2371 2372 |
# File 'lib/infrawrench/client.rb', line 2364 def verify(factor_id:, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/profile/mfa/{factorId}/verify", path_params: { "factorId" => factor_id }, body: body, request_options: ) end |