Courseiva
Java I/O API and Securing ApplicationshardMultiple ChoiceObjective-mapped

1Z0-829 Java I/O API and Securing Applications Practice Question

In a JAAS login module, after the login() method returns true, which method must be called to commit the authentication and add principals to the Subject?

⚠ Common exam trap

A common mix-up: candidates confuse the purpose of `login()` and `commit()`, mistakenly thinking that `login()` both authenticates and adds principals, when in fact `login()` only performs verification and `commit()` is required to populate the Subject.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

commit()

In a JAAS login module, after the `login()` method returns `true`, the `commit()` method must be called to associate the authenticated principals and credentials with the `Subject`. The `commit()` method is responsible for adding the successfully authenticated principals to the Subject, making them available for subsequent authorization checks. This is part of the two-phase authentication protocol defined by the `javax.security.auth.spi.LoginModule` interface.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • login()

    Why it's wrong here

    login() validates credentials; commit() follows.

  • initialize()

    Why it's wrong here

    initialize() is for initializing the LoginModule, not for committing.

  • commit()

    Why this is correct

    commit() commits the authentication and associates principals with the Subject.

  • abort()

    Why it's wrong here

    abort() is used to clean up if authentication fails.

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.