forked from apolloconfig/apollo
-
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.
Enhancement: validation (apolloconfig#1869)
* Enhancement: validates http parameters using javax.validation api * remove unnecessary validation
- Loading branch information
1 parent
96dca9d
commit f755353
Showing
15 changed files
with
176 additions
and
82 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package com.ctrip.framework.apollo; | ||
|
||
import com.ctrip.framework.apollo.openapi.auth.ConsumerPermissionValidator; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil; | ||
import com.ctrip.framework.apollo.portal.component.PermissionValidator; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Primary; | ||
|
@@ -13,17 +14,34 @@ | |
/** | ||
* Created by kezhenxu at 2019/1/8 20:19. | ||
* | ||
* Configuration class that will disable authorization. | ||
* | ||
* @author kezhenxu ([email protected]) | ||
*/ | ||
@Profile("skipAuthorization") | ||
@Configuration | ||
public class SkipAuthorizationConfiguration { | ||
@Primary | ||
@Bean | ||
@Qualifier("consumerPermissionValidator") | ||
public ConsumerPermissionValidator consumerPermissionValidator() { | ||
ConsumerPermissionValidator mock = mock(ConsumerPermissionValidator.class); | ||
final ConsumerPermissionValidator mock = mock(ConsumerPermissionValidator.class); | ||
when(mock.hasCreateNamespacePermission(any(), any())).thenReturn(true); | ||
return mock; | ||
} | ||
|
||
@Primary | ||
@Bean | ||
public ConsumerAuthUtil consumerAuthUtil() { | ||
final ConsumerAuthUtil mock = mock(ConsumerAuthUtil.class); | ||
when(mock.getConsumerId(any())).thenReturn(1L); | ||
return mock; | ||
} | ||
|
||
@Primary | ||
@Bean("permissionValidator") | ||
public PermissionValidator permissionValidator() { | ||
final PermissionValidator mock = mock(PermissionValidator.class); | ||
when(mock.isSuperAdmin()).thenReturn(true); | ||
return mock; | ||
} | ||
} |
Oops, something went wrong.