Skip to content

Commit e2cdac4

Browse files
committed
Merge pull request #1025 from lugaru1234/remove_authorization_type_support
@Authorization.type() value support and SecurityDefinition class have be...
2 parents afd26df + 203dfd3 commit e2cdac4

File tree

15 files changed

+17
-66
lines changed

15 files changed

+17
-66
lines changed

modules/swagger-annotations/src/main/java/com/wordnik/swagger/annotations/Api.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
*
140140
* @return an array of authorizations required by the server, or a single, empty authorization value if not set
141141
*/
142-
Authorization[] authorizations() default @Authorization(value = "", type = "");
142+
Authorization[] authorizations() default @Authorization(value = "");
143143

144144
/**
145145
* Hides the api.

modules/swagger-annotations/src/main/java/com/wordnik/swagger/annotations/ApiOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
//String authorizations() default "";
7272

7373
/** authorizations required by this Api */
74-
Authorization[] authorizations() default @Authorization(value = "", type = "");
74+
Authorization[] authorizations() default @Authorization(value = "");
7575

7676
/**
7777
* Allows an operation to be marked as hidden

modules/swagger-annotations/src/main/java/com/wordnik/swagger/annotations/Authorization.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@
2525
@Retention(RetentionPolicy.RUNTIME)
2626
public @interface Authorization {
2727
String value();
28-
String type();
2928
AuthorizationScope[] scopes() default @AuthorizationScope(scope = "", description = "");
3029
}

modules/swagger-core/src/test/scala/ScalaTest.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import scala.collection.JavaConverters._
99
import org.junit.runner.RunWith
1010
import org.scalatest.junit.JUnitRunner
1111
import org.scalatest.FlatSpec
12+
1213
import org.scalatest.Matchers
1314

1415
import matchers.SerializationMatchers._

modules/swagger-jaxrs/src/main/java/com/wordnik/swagger/jaxrs/Reader.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import com.wordnik.swagger.models.Path;
4040
import com.wordnik.swagger.models.Response;
4141
import com.wordnik.swagger.models.Scheme;
42-
import com.wordnik.swagger.models.SecurityDefinition;
4342
import com.wordnik.swagger.models.SecurityRequirement;
4443
import com.wordnik.swagger.models.SecurityScope;
4544
import com.wordnik.swagger.models.Swagger;
@@ -415,10 +414,8 @@ public Operation parseMethod(Method method) {
415414
security.setName(auth.value());
416415
AuthorizationScope[] scopes = auth.scopes();
417416
for(AuthorizationScope scope : scopes) {
418-
SecurityDefinition definition = new SecurityDefinition(auth.type());
419417
if(scope.scope() != null && !"".equals(scope.scope())) {
420418
security.addScope(scope.scope());
421-
definition.scope(scope.scope(), scope.description());
422419
}
423420
}
424421
securities.add(security);

modules/swagger-models/src/main/java/com/wordnik/swagger/models/SecurityDefinition.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

samples/java-jaxrs-no-webxml/src/main/java/com/wordnik/swagger/sample/resource/PetResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
@Path("/pet")
3131
@Api(value = "/pet", description = "Operations about pets", authorizations = {
32-
@Authorization(value = "petstore_auth", type = "oauth2",
32+
@Authorization(value = "petstore_auth",
3333
scopes = {
3434
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
3535
@AuthorizationScope(scope = "read:pets", description = "read your pets")
@@ -45,7 +45,7 @@ public class PetResource {
4545
@ApiOperation(value = "Find pet by ID",
4646
notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
4747
response = Pet.class,
48-
authorizations = @Authorization(value = "api_key", type = "api_key")
48+
authorizations = @Authorization(value = "api_key")
4949
)
5050
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"),
5151
@ApiResponse(code = 404, message = "Pet not found") })

samples/java-jaxrs-no-webxml/src/main/java/com/wordnik/swagger/sample/resource/PetStoreResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class PetStoreResource {
4040
notes = "Returns a map of status codes to quantities",
4141
response = Integer.class,
4242
responseContainer = "map",
43-
authorizations = @Authorization(value = "api_key", type = "api_key")
43+
authorizations = @Authorization(value = "api_key")
4444
)
4545
public java.util.Map<String, Integer> getInventory() {
4646
return petData.getInventoryByStatus();

samples/java-jaxrs/src/main/java/com/wordnik/swagger/sample/resource/PetResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
@Path("/pet")
3131
@Api(value = "/pet", description = "Operations about pets", authorizations = {
32-
@Authorization(value = "petstore_auth", type = "oauth2",
32+
@Authorization(value = "petstore_auth",
3333
scopes = {
3434
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
3535
@AuthorizationScope(scope = "read:pets", description = "read your pets")
@@ -45,7 +45,7 @@ public class PetResource {
4545
@ApiOperation(value = "Find pet by ID",
4646
notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
4747
response = Pet.class,
48-
authorizations = @Authorization(value = "api_key", type = "api_key")
48+
authorizations = @Authorization(value = "api_key")
4949
)
5050
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"),
5151
@ApiResponse(code = 404, message = "Pet not found") })

samples/java-jaxrs/src/main/java/com/wordnik/swagger/sample/resource/PetStoreResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class PetStoreResource {
4040
notes = "Returns a map of status codes to quantities",
4141
response = Integer.class,
4242
responseContainer = "map",
43-
authorizations = @Authorization(value = "api_key", type = "api_key")
43+
authorizations = @Authorization(value = "api_key")
4444
)
4545
public java.util.Map<String, Integer> getInventory() {
4646
return petData.getInventoryByStatus();

0 commit comments

Comments
 (0)