Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
llyppi committed May 28, 2022
1 parent dd97644 commit 1f8f55c
Show file tree
Hide file tree
Showing 23 changed files with 2,705 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
global: CODECOV_TOKEN="2215f466-5f0d-417f-b4f3-ea60ccdb863e"

language: java
jdk:
- oraclejdk8
sudo: false
script: mvn clean verify
script: "mvn cobertura:cobertura"
after_success:
- bash <(curl -s https://codecov.io/bash) -t "2215f466-5f0d-417f-b4f3-ea60ccdb863e"
- bash <(curl -s https://codecov.io/bash)

11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## Continuous Integration|Coverage|Analysis
## Coverage
[![Code Climate](https://codeclimate.com/github/llyppi/polls.png)](https://codeclimate.com/github/llyppi/polls)
[![codecov](https://codecov.io/gh/llyppi/polls/branch/master/graph/badge.svg)](https://codecov.io/gh/llyppi/polls)
<br>[![codecov](https://codecov.io/gh/llyppi/polls/branch/master/graph/badge.svg)](https://codecov.io/gh/llyppi/polls)
## Analysis
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7c7334e6f740470fbe6920c4c974ff0b)](https://www.codacy.com/app/llyppi/polls?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=llyppi/polls&amp;utm_campaign=Badge_Grade)
## Continuous Integration
[![Build Status](https://travis-ci.org/llyppi/polls.svg?branch=master)](https://travis-ci.org/llyppi/polls)

## Synopsis
Expand All @@ -11,6 +13,9 @@
## Installation
Build project,Netbeas,Eclipse

## Teste
https://multware.com/apipolls

</tab>[ClientGet](../master/src/main/java/com/app/client/ClientGet.java)
<br>[ClientPost](../master/src/main/java/com/app/client/ClientPost.java)

Expand All @@ -25,7 +30,7 @@
* Votar na Questions
* POST http://localhost:8080/apipolls/polls/questions/1/choices/1 Requer Header Authorization token
* Gerar Token
* POST http://localhost:8080/apipolls/polls/tokens?username=usuario&password=senha
* POST http://localhost:8084/apipolls/polls/tokens?username=usuario&password=senha

## Java

Expand Down
30 changes: 25 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.app</groupId>

<groupId>br.com.app</groupId>
<artifactId>apiPolls</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>apiPolls</name>
<url>http://maven.apache.org</url>


<build>
Expand Down Expand Up @@ -175,7 +175,27 @@
<artifactId>genson</artifactId>
<version>0.99</version>
</dependency>

<dependency>
<groupId>uteisJava</groupId>
<artifactId>uteisJava</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.4</version>
<classifier>javadoc</classifier>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
</dependencies>


Expand Down
74 changes: 74 additions & 0 deletions src/main/java/br/com/app/AuthenticationFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package br.com.app;

//import com.sun.jersey.core.util.Priority;
//import java.io.IOException;
//import java.util.Calendar;
//import java.util.Map;
//import javax.ws.rs.NotAuthorizedException;
//import javax.ws.rs.Priorities;
//import javax.ws.rs.container.ContainerRequestContext;
//import javax.ws.rs.container.ContainerRequestFilter;
//import javax.ws.rs.core.HttpHeaders;
//import javax.ws.rs.core.Response;
//import javax.ws.rs.ext.Provider;

/**
* Classe sempre autentifica metodos que possui @Secured
*
* @author Felipe L. Garcia
*/
//@Secured
//@Provider
//@Priority(Priorities.AUTHENTICATION)
public class AuthenticationFilter {//implements ContainerRequestFilter {

// @Override
// public void filter(ContainerRequestContext requestContext) throws IOException {
//
// // Get the HTTP Authorization header from the request
// String authorizationHeader =
// requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
//
// // Check if the HTTP Authorization header is present and formatted correctly
// if (authorizationHeader == null
// || !authorizationHeader.startsWith("token ")) {
// throw new NotAuthorizedException("Authorization header must be provided");
// }
//
// // Extract the token from the HTTP Authorization header
// String token = authorizationHeader.substring("token ".length()).trim();
//
// try {
//
// validateToken(token);
//
// } catch (Exception e) {
// requestContext.abortWith(
// Response.status(Response.Status.UNAUTHORIZED).build());
// }
// }
//
// /** Validar timeCreate+timeExp > NOW*/
// private void validateToken(String token) throws Exception {
// Map<Token,Long> listToken = PollsService.getListToken();
//
// for (Map.Entry<Token, Long> entry : listToken.entrySet()) {
// Token tok = entry.getKey();
// Long timeCreate = entry.getValue();
// //BUSCAR TOKEN
// if(!tok.getAccess_token().equals(token)){
// continue;
// }
//
// Calendar calendar = Calendar.getInstance();
// calendar.setTimeInMillis(timeCreate);
// //DIMINUIR TEMPO DE EXPIRAR TOKEN
// calendar.add(Calendar.MILLISECOND, (int) tok.getExpires_in());
// //DENTRO DO PRAZO
// if(calendar.getTimeInMillis() > System.currentTimeMillis()){
// return ;
// }
// }
// throw new Exception("Token inválido");
// }
}
46 changes: 46 additions & 0 deletions src/main/java/br/com/app/Choice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package br.com.app;
/**
*
* @author Felipe L. Garcia
*/
public class Choice {

private int choice_id;
private String choice;
private String url;
private int votes;

public int getChoice_id() {
return choice_id;
}

public void setChoice_id(int choice_id) {
this.choice_id = choice_id;
}

public String getChoice() {
return choice;
}

public void setChoice(String choice) {
this.choice = choice;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public int getVotes() {
return votes;
}

public void setVotes(int votes) {
this.votes = votes;
}


}
17 changes: 17 additions & 0 deletions src/main/java/br/com/app/EntryPoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package br.com.app;
/**
*
* @author Felipe L. Garcia
*/
public class EntryPoint {
private String url;

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

}
Loading

0 comments on commit 1f8f55c

Please sign in to comment.