Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/youkol/scribejava-spring-boot-starter
scrivejava for spring boot starter
https://github.com/youkol/scribejava-spring-boot-starter
oauth2 scribejava scribejava-spring-boot-starter spring spring-boot
Last synced: 10 days ago
JSON representation
scrivejava for spring boot starter
- Host: GitHub
- URL: https://github.com/youkol/scribejava-spring-boot-starter
- Owner: youkol
- License: apache-2.0
- Created: 2020-07-09T11:20:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-22T19:43:00.000Z (over 4 years ago)
- Last Synced: 2024-12-18T06:21:41.875Z (14 days ago)
- Topics: oauth2, scribejava, scribejava-spring-boot-starter, spring, spring-boot
- Language: Java
- Homepage: https://github.com/youkol/scribejava-spring-boot-starter
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### scribejava-spring-boot-starter
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.youkol.support.scribejava/scribejava-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.youkol.support.scribejava/scribejava-spring-boot-starter)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.youkol.support.scribejava/scribejava-spring-boot-starter?server=https%3A%2F%2Foss.sonatype.org)](https://oss.sonatype.org/content/repositories/snapshots/com/youkol/support/scribejava/scribejava-spring-boot-starter/)
[![License](https://img.shields.io/badge/license-apache-brightgreen)](http://www.apache.org/licenses/LICENSE-2.0.html)scribejava for spring boot autoconfigure.
#### Features
- [x] OAuth2ServiceDelegate. You can customize your own delegate. For example: [SinaWeiboOAuth2ServiceDelegate](https://github.com/youkol/scribejava-spring-boot-starter/blob/master/src/main/java/com/youkol/support/scribejava/service/delegate/SinaWeiboOAuth2ServiceDelegate.java)
- [x] Support for basic oauth2 authorization operations. For more information, please see
[BasicOAuth2LoginController](https://github.com/youkol/scribejava-spring-boot-starter/blob/master/src/main/java/com/youkol/support/scribejava/spring/autoconfigure/oauth2/client/servlet/BasicOAuth2LoginController.java)
- [x] Support for Authentication Success Handler and Failure Handler.
- [x] Support for ApplicationEventPublisher.#### Usage
For Maven
```xmlcom.youkol.support.scribejava
scribejava-spring-boot-starter
${scribejava.spring.version}```
Spring-boot application.yml
```yml
youkol:
oauth2:
web:
enabled: true # default true
authorize:
path: "/oauth2/authorize/{registrationId}" # default
callback:
path: "/oauth2/callback/{registrationId}" # default
client:
enabled: true
registration:
wechat_offical: # => OAuth2ServiceDelegate.getName()
client-id: [your apikey]
client-secret: [your apiSecret]
scope: [default scope]
redirect-uri: "{baseUrl}/oauth2/callback/{registrationId}?redirect_uri={redirect_uri}" # for example
```
For your project
```java
@Configuration
public class ScribejavaConfig {
@Bean
public SinaWeiboOAuth2ServiceDelegate sinaWeiboOAuth2ServiceDelegate(
ClientRegistrationRepository clientRegistrationRepository,
Optional objectMapper) {
SinaWeiboOAuth2ServiceDelegate delegate = new SinaWeiboOAuth2ServiceDelegate(clientRegistrationRepository);
delegate.setObjectMapper(objectMapper);return delegate;
}
@Bean
public WeChatMpOAuth2ServiceDelegate weChatMpOAuth2ServiceDelegate(
ClientRegistrationRepository clientRegistrationRepository,
Optional objectMapper) {
WeChatMpOAuth2ServiceDelegate delegate = new WeChatMpOAuth2ServiceDelegate(clientRegistrationRepository);
delegate.setObjectMapper(objectMapper);return delegate;
}@Bean
public AuthenticationSuccessHandler customAuthenticationSuccessHandler() {
return new CunstomAuthenticationSuccessHandler();
}@Bean
public AuthenticationFailureHandler customAuthenticationFailureHandler() {
return new CunstomAuthenticationFailureHandler();
}
}
```#### NOTE
Thanks to spring and spring-security project.
When the project allows, recommend spring-security.