• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OAuth2Definition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.swagger.models.auth.OAuth2Definition的典型用法代码示例。如果您正苦于以下问题:Java OAuth2Definition类的具体用法?Java OAuth2Definition怎么用?Java OAuth2Definition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OAuth2Definition类属于io.swagger.models.auth包,在下文中一共展示了OAuth2Definition类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: afterScan

import io.swagger.models.auth.OAuth2Definition; //导入依赖的package包/类
@Override
public void afterScan(Reader reader, Swagger swagger) {
    OAuth2Definition tokenScheme = new OAuth2Definition();
    tokenScheme.setType("oauth2");
    tokenScheme.setFlow("application");
    tokenScheme.setTokenUrl("https://" + swagger.getHost() + "/oauth2/token");
    tokenScheme.setAuthorizationUrl("https://" + swagger.getHost() + "/oauth2/authorize");
    tokenScheme.addScope("write:everything", "Full access");

    Map<String, SecuritySchemeDefinition> schemes = new HashMap<>();
    schemes.put(TOKEN_AUTH_SCHEME, tokenScheme);

    swagger.setSecurityDefinitions(schemes);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:15,代码来源:SecurityDefinitionConfigurator.java


示例2: init

import io.swagger.models.auth.OAuth2Definition; //导入依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
    Info info = new Info()
            .title("Swagger Petstore")
            .description("This is a sample server Petstore server.  You can find out more about Swagger " +
                    "at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, " +
                    "you can use the api key `special-key` to test the authorization filters.")
            .termsOfService("http://swagger.io/terms/")
            .contact(new Contact()
                    .email("[email protected]"))
            .license(new License()
                    .name("Apache 2.0")
                    .url("http://www.apache.org/licenses/LICENSE-2.0.html"));

    ServletContext context = config.getServletContext();
    Swagger swagger = new Swagger()
            .info(info);
    swagger.securityDefinition("petstore_auth",
            new OAuth2Definition()
                    .implicit("http://localhost:8002/oauth/dialog")
                    .scope("email", "Access to your email address")
                    .scope("pets", "Access to your pets"));
    swagger.tag(new Tag()
            .name("pet")
            .description("Everything about your Pets")
            .externalDocs(new ExternalDocs("Find out more", "http://swagger.io")));
    swagger.tag(new Tag()
            .name("store")
            .description("Access to Petstore orders"));
    swagger.tag(new Tag()
            .name("user")
            .description("Operations about user")
            .externalDocs(new ExternalDocs("Find out more about our store", "http://swagger.io")));
    context.setAttribute("swagger", swagger);
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:36,代码来源:Bootstrap.java


示例3: toScheme

import io.swagger.models.auth.OAuth2Definition; //导入依赖的package包/类
private static SecuritySchemeDefinition toScheme(
    IssuerConfig issuerConfig, ImmutableSet<String> audiences) {
  OAuth2Definition tokenDef = new OAuth2Definition().implicit("");
  tokenDef.setVendorExtension("x-google-issuer", issuerConfig.getIssuer());
  if (!com.google.common.base.Strings.isNullOrEmpty(issuerConfig.getJwksUri())) {
    tokenDef.setVendorExtension("x-google-jwks_uri", issuerConfig.getJwksUri());
  }
  tokenDef.setVendorExtension("x-google-audiences", COMMA_JOINER.join(audiences));
  return tokenDef;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:11,代码来源:SwaggerGenerator.java


示例4: afterScan

import io.swagger.models.auth.OAuth2Definition; //导入依赖的package包/类
@Override
public void afterScan(Reader reader, Swagger swagger) {
    OAuth2Definition tokenScheme = new OAuth2Definition();
    tokenScheme.setType("oauth2");
    tokenScheme.setFlow("application");
    tokenScheme.setTokenUrl("https://" + swagger.getHost() + "/oauth2/token");
    tokenScheme.setAuthorizationUrl("https://" + swagger.getHost() + "/oauth2/authorize");
    tokenScheme.addScope("write:everything", "Full access");

    Map<String, SecuritySchemeDefinition> schemes = new HashMap<>();
    schemes.put(TOKEN_AUTH_SCHEME, tokenScheme);

    swagger.setSecurityDefinitions(schemes);
   //TODO: Have to add wso2-scopes to swagger definition from here
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:16,代码来源:SecurityDefinitionConfigurator.java


示例5: buildSecurityScheme

import io.swagger.models.auth.OAuth2Definition; //导入依赖的package包/类
private MarkupDocBuilder buildSecurityScheme(MarkupDocBuilder markupDocBuilder, SecuritySchemeDefinition securityScheme) {
    String type = securityScheme.getType();
    MarkupDocBuilder paragraphBuilder = copyMarkupDocBuilder(markupDocBuilder);

    paragraphBuilder.italicText(labels.getLabel(TYPE)).textLine(COLON + type);

    if (securityScheme instanceof ApiKeyAuthDefinition) {
        paragraphBuilder.italicText(labels.getLabel(NAME)).textLine(COLON + ((ApiKeyAuthDefinition) securityScheme).getName());
        paragraphBuilder.italicText(labels.getLabel(IN)).textLine(COLON + ((ApiKeyAuthDefinition) securityScheme).getIn());

        return markupDocBuilder.paragraph(paragraphBuilder.toString(), true);
    } else if (securityScheme instanceof OAuth2Definition) {
        OAuth2Definition oauth2Scheme = (OAuth2Definition) securityScheme;
        String flow = oauth2Scheme.getFlow();
        paragraphBuilder.italicText(labels.getLabel(FLOW)).textLine(COLON + flow);
        if (isNotBlank(oauth2Scheme.getAuthorizationUrl())) {
            paragraphBuilder.italicText(labels.getLabel(AUTHORIZATION_URL)).textLine(COLON + oauth2Scheme.getAuthorizationUrl());
        }
        if (isNotBlank(oauth2Scheme.getTokenUrl())) {
            paragraphBuilder.italicText(labels.getLabel(TOKEN_URL)).textLine(COLON + oauth2Scheme.getTokenUrl());
        }

        markupDocBuilder.paragraph(paragraphBuilder.toString(), true);

        if (oauth2Scheme.getScopes() != null && !oauth2Scheme.getScopes().isEmpty()) {
            StringColumn.Builder nameColumnBuilder = StringColumn.builder(StringColumnId.of(labels.getLabel(NAME_COLUMN)))
                    .putMetaData(TableComponent.WIDTH_RATIO, "3")
                    .putMetaData(TableComponent.HEADER_COLUMN, "true");
            StringColumn.Builder descriptionColumnBuilder = StringColumn.builder(StringColumnId.of(labels.getLabel(DESCRIPTION_COLUMN)))
                    .putMetaData(TableComponent.WIDTH_RATIO, "17")
                    .putMetaData(TableComponent.HEADER_COLUMN, "true");

            for (Map.Entry<String, String> scope : oauth2Scheme.getScopes().entrySet()) {
                nameColumnBuilder.add(scope.getKey());
                descriptionColumnBuilder.add(scope.getValue());
            }

            return tableComponent.apply(markupDocBuilder, TableComponent.parameters(nameColumnBuilder.build(),
                    descriptionColumnBuilder.build()));
        } else {

            return markupDocBuilder;
        }

    } else {
        return markupDocBuilder.paragraph(paragraphBuilder.toString(), true);
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:49,代码来源:SecuritySchemeDefinitionComponent.java


示例6: oAuth2

import io.swagger.models.auth.OAuth2Definition; //导入依赖的package包/类
public static OAuth2Definition oAuth2() {
    return new OAuth2Definition();
}
 
开发者ID:tminglei,项目名称:binder-swagger-java,代码行数:4,代码来源:SwaggerContext.java



注:本文中的io.swagger.models.auth.OAuth2Definition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Repository类代码示例发布时间:2022-05-22
下一篇:
Java EncodedValueUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap