This repository has been archived by the owner on May 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d75b4a9
commit 0383f4b
Showing
8 changed files
with
76 additions
and
45 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
spring-auth/src/main/java/com/gewia/common/spring/auth/AuthScope.java
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,18 @@ | ||
package com.gewia.common.spring.auth; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Repeatable; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
@Repeatable(Authentication.class) | ||
public @interface AuthScope { | ||
|
||
String value() default ""; | ||
|
||
String scope() default ""; | ||
|
||
} |
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 |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
@Target(ElementType.METHOD) | ||
public @interface Authentication { | ||
|
||
String scope() default ""; | ||
AuthScope[] value(); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
spring-auth/src/main/java/com/gewia/common/spring/auth/IgnoreServiceToken.java
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,11 @@ | ||
package com.gewia.common.spring.auth; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface IgnoreServiceToken { | ||
} |
19 changes: 11 additions & 8 deletions
19
spring-auth/src/main/java/com/gewia/common/spring/auth/SpringAuthentication.java
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 |
---|---|---|
@@ -1,20 +1,23 @@ | ||
package com.gewia.common.spring.auth; | ||
|
||
import com.gewia.common.spring.auth.interceptor.AuthenticationInterceptor; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.annotation.PostConstruct; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; | ||
|
||
public abstract class SpringAuthentication { | ||
@ComponentScan("com.gewia.common.spring.auth") | ||
public abstract class SpringAuthentication implements InitializingBean { | ||
|
||
@Getter private static List<AuthenticationInterceptor> authenticationInterceptors = new ArrayList<>(); | ||
@Getter(AccessLevel.PACKAGE) private static List<HandlerInterceptorAdapter> interceptors = new ArrayList<>(); | ||
|
||
@PostConstruct | ||
public void registerInterceptor() { | ||
authenticationInterceptors = this.addAuthenticationInterceptors(authenticationInterceptors); | ||
@Override | ||
public void afterPropertiesSet() throws Exception { | ||
interceptors = this.addAuthenticationInterceptors(interceptors); | ||
} | ||
|
||
abstract public List<AuthenticationInterceptor> addAuthenticationInterceptors(List<AuthenticationInterceptor> authenticationInterceptors); | ||
abstract public List<HandlerInterceptorAdapter> addAuthenticationInterceptors(List<HandlerInterceptorAdapter> authenticationInterceptors); | ||
|
||
} |
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
23 changes: 0 additions & 23 deletions
23
...uth/src/main/java/com/gewia/common/spring/auth/interceptor/AuthenticationInterceptor.java
This file was deleted.
Oops, something went wrong.
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
11 changes: 10 additions & 1 deletion
11
...uthenticationServiceTokenInterceptor.java → .../interceptor/ServiceTokenInterceptor.java
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