Question
I have know idea how to do this assigment. Can someone help me? I am really doing bad in this class I dont want to
I have know idea how to do this assigment. Can someone help me? I am really doing bad in this class I dont want to get failing the assigments.
Prompt
Begin by importing the gameauth.zip file into Eclipse as a new Maven project. If you have not already practiced using Maven, be sure to follow the instructions in the Dropwizard Hello World Tutorial PDF.
Note: You may need to update the dropwizard version in the pom.xml file to align with the version that you are using.
To view the specific tasks you have been assigned, navigate in your Eclipse project to the Window, then Show View, then Tasks view. You can double-click on any of the tasks to be directed to the line of code where the task that needs to be completed is located. Specifically, review and complete all assigned tasks outlined below as indicated in the FIXME comments within the various Java files. A text version of this image is available: FIXME Text Version Word Document.
User Interface: Write code to create the user interface for entering data for user authentication and securing REST APIs with the proper annotation. To do this, you must complete the following tasks in the GameAuthApplication.java file based on the BasicAuth Security Example:
Register the GameUserREST Controller.
Create a JerseyClientBuilder instance named DemoRESTClient.
Client: Write code to expose the Controller class and create a path for the client-side endpoint. To do this, you must complete the following tasks in the corresponding Java files:
GameUserRESTController.java: Add the proper annotation to expose this Controller class with the base endpoint URL as /gameusers.
RESTClientController.java: Add the proper annotation for the HTTP GET method and a path of /gameusers/ to expose an endpoint in order to return a list of all game users.
Authentication and Authorization (Server): Create a username and password-based authentication and role-based authorization for users, using annotations that set up permissions for the users. To do this, you must complete the following tasks in the corresponding Java files based on the BasicAuth Security Example:
GameAuthenticator.java: Complete the Authenticator method by verifying a new instance of the GameUser class based upon the username that has been authenticated.
GameAuthorizer.java: Complete the Authorizer method by roles of the user in the GameUser class based upon the username that has been authenticated. This completes the interface requirement for authentication using the Basic Authentication method.
User Protection and Security: Complete a REST Application including all classes, resources, and representations, along with APIs that request validation and are tested and verified using data provided. To do this, you must complete the following tasks in the GameUserRESTController.java file based on the BasicAuth Security Example:
Add the proper RolesAllowed annotation to restrict the createGameUser HTTP POST method to only authenticated users with the ADMIN role.
Add the proper RolesAllowed annotation to restrict the getGameUserById HTTP GET method to only authenticated users with the USER role.
Test your code by running the application in Eclipse.
Remember to add the values server config.yml as Program Arguments on the Arguments tab of Run Configuration.
Use any web browser to visit the URL http://localhost:8080/gameusers. The browsers Basic Authentication dialog should appear with blank fields for Username and Password as shown below:
Valid usernames to try are guest, user, player, and admin, all with the same password value of password. Upon successful authentication, you will see the list of game players returned as a JSON string:
[{"id":1,"firstName":"Lokesh","lastName":"Gupta","email":"India"},{"id":2,"firstName":"John","lastName":"Gruber","email":"USA"},{"id":3,"firstName":"Melcum","lastName":"Marshal","email":"AUS"}]
Visiting the URL http://localhost:8080/gameusers/1 while logged in as a user in the USER role will return the player whose ID is 1 (Lokesh Gupta). Visiting the URL with /2 will return the player whose ID is 2 (John Gruber), and so on. Close the browser, then reopen it and try accessing the same URL as a player or guest, and you should see the following JSON string displayed:
{"code":403,"message":"User not authorized."}
Industry Standard Best Practices: Be sure to demonstrate industry standard best practices in your code, including descriptive in-line comments and appropriate variable and method naming conventions.
---------------------------------------------------------------------------------------------
GameAuthApplication,java
package com.dropwizard.gameauth;
import io.dropwizard.core.Application; import io.dropwizard.core.setup.Bootstrap; import io.dropwizard.core.setup.Environment;
public class GameAuthApplication extends Application
public static void main(final String[] args) throws Exception { new GameAuthApplication().run(args); }
@Override public String getName() { return "GameAuth"; }
@Override public void initialize(final Bootstrap
@Override public void run(final GameAuthConfiguration configuration, final Environment environment) { // TODO: implement application }
} --------------------------------------------------------------------------------------
GameAuthConfiguration.java
package com.dropwizard.gameauth;
import io.dropwizard.core.Configuration; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.*; import jakarta.validation.constraints.*;
public class GameAuthConfiguration extends Configuration { // TODO: implement service configuration }
\---------------------------------------------------------------
Sign in http://localhost:8080 Username Password Mid gameauth src/main/ java GameAuth com.dropwizard.gameauth > GameAuthApplication.java > GameAuthConfiguration.java com.dropwizard.gameauth.api How to start the GameAuth application com.dropwizard.gameauth.cli com.dropwizard.gameauth.client com.dropwizard.gameauth.core 1. Run mvn clean install to build your application com.dropwizard.gameauth.db 2. Start application with java -jar target/gameauth-0.0.1-SNAPSHOT.jar server config.yml com.dropwizard.gameauth.health 3. To check that your application is running enter url http://1ocalhost: 8080 com.dropwizard.gameauth.resources rrc/main/ resources assets Health Check banner.txt src/ test/java com.dropwizard.gameauth.api To see your applications health enter url http: // localhost : 8081 /healthcheck com.dropwizard.gameauth.client com.dropwizard.gameauth.core com.dropwizard.gameauth.db com.dropwizard.gameauth.resources src/test/ resources B fixtures > JRE System Library [JavaSE-11] > E Maven Dependencies > gameauth >8 src target config.yml pom.xml README.md README.md - gameauth
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started