-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Firebase Documentation (#911)
Add reference documentation for security-firebase module. Mentioning Firebase starter and sample in getting-started and sagan-index. Edits in sample readme and Javadoc format for better readability. Fix a typo in sample.
- Loading branch information
Showing
7 changed files
with
98 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
:spring-security-ref: https://docs.spring.io/spring-security/reference/ | ||
:spring-security-javadoc: https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/ | ||
|
||
[#security-firebase] | ||
== Firebase Authentication | ||
|
||
https://firebase.google.com/products/auth[Firebase Authentication] provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your link:https://firebase.google.com/[Firebase] app. | ||
|
||
The Security Firebase starter uses {spring-security-ref}servlet/oauth2/resource-server/index.html[Spring Security OAuth 2.0 Resource Server] functionality to extract user identity from OAuth2 Authorization header. | ||
|
||
The Firebase JWT tokens are validated with rules presented link:https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library[here]. The following claims are validated automatically: | ||
|
||
* Expiration time: Must be in the future | ||
* Issued-at time : Must be in the past | ||
* Audience : Must be the firebase project id | ||
* Issuer: Must be "https://securetoken.google.com/`<projectId>` " | ||
* Authentication time : Must be in the past | ||
* Subject : Must not be empty | ||
NOTE: If you create a custom {spring-security-javadoc}config/annotation/web/configuration/WebSecurityConfigurerAdapter.html[`WebSecurityConfigurerAdapter`], enable extracting user identity by adding `.oauth2ResourceServer().jwt()` configuration to the {spring-security-javadoc}config/annotation/web/builders/HttpSecurity.html[`HttpSecurity`] object. | ||
If no custom {spring-security-javadoc}config/annotation/web/configuration/WebSecurityConfigurerAdapter.html[`WebSecurityConfigurerAdapter`] is present, nothing needs to be done because Spring Boot will add this customization by default. | ||
|
||
Starter Maven coordinates, using <<getting-started.adoc#bill-of-materials, Spring Cloud GCP BOM>>: | ||
|
||
[source,xml] | ||
---- | ||
<dependency> | ||
<groupId>com.google.cloud</groupId> | ||
<artifactId>spring-cloud-gcp-starter-security-firebase</artifactId> | ||
</dependency> | ||
---- | ||
|
||
Starter Gradle coordinates: | ||
|
||
[source] | ||
---- | ||
dependencies { | ||
implementation("com.google.cloud:spring-cloud-gcp-starter-security-firebase") | ||
} | ||
---- | ||
|
||
=== Configuration | ||
The following properties are available. | ||
|
||
CAUTION: Modifying public-keys-endpoint property might be useful for testing, but the defaults should not be changed in production. | ||
|
||
|==================================================== | ||
|Name |Description |Required |Default | ||
|
||
|`spring.cloud.gcp.security.firebase.project-id` | ||
|Overrides the GCP project ID specified in the Core module. | ||
|false | ||
| | ||
|
||
|`spring.cloud.gcp.security.firebase.public-keys-endpoint` | ||
|Link to Google's public endpoint containing Firebase public keys. | ||
|true | ||
|`https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com` | ||
|
||
|==================================================== | ||
|
||
=== Sample | ||
|
||
A link:https://github.com/GoogleCloudPlatform/spring-cloud-gcp/tree/main/spring-cloud-gcp-samples/spring-cloud-gcp-security-firebase-sample[sample application] is available. This sample app provides simple login page using link:https://github.com/firebase/firebaseui-web[firebase-ui] to fetch the JWT token. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters