Question: package com.gamingroom.gameauth.auth; import io.dropwizard.auth.AuthenticationException; import io.dropwizard.auth.Authenticator; import io.dropwizard.auth.basic.BasicCredentials; import java.util.Map; import java.util.Optional; import java.util.Set; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; public class GameAuthenticator implements Authenticator { private

package com.gamingroom.gameauth.auth; import io.dropwizard.auth.AuthenticationException; import io.dropwizard.auth.Authenticator; import io.dropwizard.auth.basic.BasicCredentials; import java.util.Map; import java.util.Optional; import java.util.Set; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; public class GameAuthenticator implements Authenticator { private static final Map> VALID_USERS = ImmutableMap.of( "guest", ImmutableSet.of(), "user", ImmutableSet.of("USER"), "admin", ImmutableSet.of("ADMIN", "USER") ); @Override public Optional authenticate(BasicCredentials credentials) throws AuthenticationException { if (VALID_USERS.containsKey(credentials.getUsername()) && "password".equals(credentials.getPassword())) { // FIXME: Finish the authorize method based on BasicAuth Security Example for new GameUser } return Optional.empty(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!