• Tutorials
  • Courses
  • Tracks

Advanced Java Quiz Day 67

Last Updated :
Discuss
Comments

Question 1

Which annotation enables method-level security in Spring Security?

  • @EnableMethodSecurity

  • @MethodSecurity

  • @EnableGlobalSecurity

  • @EnableWebSecurityOnly

Question 2

Which annotation is used to restrict access to a method to users with a specific role?

  • @RequestMapping

  • @PreAuthorize("hasRole('ADMIN')")

  • @EnableWebSecurity

  • @SecuredOnly

Question 3

What is the main purpose of antMatchers() in Spring Security?

  • Validate JWT tokens

  • Define URL patterns for access control

  • Configure password encoders

  • Generate API documentation

Question 4

In Spring Security, the method antMatchers("/admin/**").hasRole("ADMIN") means:

  • Anyone can access /admin/** URLs

  • Only authenticated users can access /admin/**

  • Only users with ADMIN role can access /admin/**

  • /admin/** is disabled

Question 5

In Spring Security 6 / Boot 3, antMatchers() is replaced by:

  • mvcMatchers()

  • authorizeHttpRequests() with .requestMatchers()

  • regexMatchers()

  • urlSecurityMatchers()

Question 6

OAuth2 authentication with GitHub typically requires which details from the GitHub Developer settings?

  • API Key only

  • Client ID and Client Secret

  • JWT Token

  • Repository name

Question 7

In Spring Boot, which dependency is needed for OAuth2 login support?

  • spring-boot-starter-oauth2-client

  • spring-security-oauth2-jwt

  • spring-oauth2-github

  • spring-boot-starter-data-oauth

Question 8

Which OAuth2 grant type is commonly used for login with GitHub in web apps?

  • Client Credentials

  • Authorization Code

  • Resource Owner Password

  • Implicit

Question 9

After successful OAuth2 login with GitHub, Spring Security stores user details in:

  • SecurityContextHolder

  • OAuth2Context

  • OAuthUserTable

  • GitHubSession

Question 10

In method-level security, which annotation denies access unless a condition is met at runtime?

  • @PostAuthorize

  • @EnableWebSecurity

  • @Secured

  • @WithSecurity

There are 11 questions to complete.

Take a part in the ongoing discussion