Questa libreria fornisce un'integrazione semplice di Firebase App Check per applicazioni Spring Boot. Permette di proteggere facilmente gli endpoint REST utilizzando un'annotazione personalizzata.
- Annotazione
@FirebaseAppCheckper proteggere gli endpoint - Verifica automatica del token Firebase App Check
- Facile integrazione con progetti Spring Boot esistenti
Per utilizzare questa libreria nel tuo progetto, aggiungi le seguenti configurazioni al tuo pom.xml:
- Aggiungi il repository GitHub Packages:
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/pierfani/firebase-appcheck-spring</url>
</repository>
</repositories>- Aggiungi la dipendenza:
<dependency>
<groupId>it.pierfani</groupId>
<artifactId>firebase-appcheck-spring-boot-starter</artifactId>
<version>1.0.3</version>
</dependency>Aggiungi le seguenti proprietà al tuo application.properties o application.yml:
it.pierfani.firebaseappcheck.project-number=YOUR_FIREBASE_PROJECT_NUMBER
it.pierfani.firebaseappcheck.jwks-url=https://firebaseappcheck.googleapis.com/v1/jwks
it.pierfani.firebaseappcheck.enabled=truePer proteggere un endpoint con Firebase App Check, aggiungi semplicemente l'annotazione @FirebaseAppCheck al metodo del controller:
import it.pierfani.firebaseappcheck.FirebaseAppCheck;
@RestController
public class ExampleController {
@GetMapping("/protected-endpoint")
@FirebaseAppCheck
public String protectedEndpoint() {
return "Questo endpoint è protetto da Firebase App Check";
}
}La libreria lancia FirebaseAppCheckException in caso di errori durante la verifica del token. Puoi gestire questa eccezione nel tuo controller o utilizzando un gestore globale delle eccezioni.
I contributi sono benvenuti! Per favore, apri una issue o una pull request per suggerimenti, bug o miglioramenti.
Questo progetto è licenziato sotto la licenza MIT. Vedi il file LICENSE per i dettagli.
This library provides a simple integration of Firebase App Check for Spring Boot applications. It allows you to easily protect REST endpoints using a custom annotation.
@FirebaseAppCheckannotation to protect endpoints- Automatic verification of Firebase App Check token
- Easy integration with existing Spring Boot projects
To use this library in your project, add the following configurations to your pom.xml:
- Add the GitHub Packages repository:
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/pierfani/firebase-appcheck-spring</url>
</repository>
</repositories>- Add the dependency:
<dependency>
<groupId>it.pierfani</groupId>
<artifactId>firebase-appcheck-spring-boot-starter</artifactId>
<version>1.0.3</version>
</dependency>Add the following properties to your application.properties or application.yml:
it.pierfani.firebaseappcheck.project-number=YOUR_FIREBASE_PROJECT_NUMBER
it.pierfani.firebaseappcheck.jwks-url=https://firebaseappcheck.googleapis.com/v1/jwks
it.pierfani.firebaseappcheck.enabled=trueTo protect an endpoint with Firebase App Check, simply add the @FirebaseAppCheck annotation to the controller method:
import it.pierfani.firebaseappcheck.FirebaseAppCheck;
@RestController
public class ExampleController {
@GetMapping("/protected-endpoint")
@FirebaseAppCheck
public String protectedEndpoint() {
return "This endpoint is protected by Firebase App Check";
}
}The library throws FirebaseAppCheckException in case of errors during token verification. You can handle this exception in your controller or using a global exception handler.
Contributions are welcome! Please open an issue or submit a pull request for any suggestions, bugs, or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.