当前位置: 首页>>代码示例>>Java>>正文


Java PermitAllAuthorizer类代码示例

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


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

示例1: createAuthFilter

import io.dropwizard.auth.PermitAllAuthorizer; //导入依赖的package包/类
@Override
public AuthFilter<?, Principal> createAuthFilter(AuthenticationBootstrap bootstrap) {
    return new BasicCredentialAuthFilter.Builder<>()
            .setAuthenticator(new BasicAuthenticator(bootstrap.getUserDAO()))
            .setAuthorizer(new PermitAllAuthorizer())
            .setRealm(realm)
            .buildAuthFilter();
}
 
开发者ID:adamkewley,项目名称:jobson,代码行数:9,代码来源:BasicAuthenticatorConfig.java

示例2: run

import io.dropwizard.auth.PermitAllAuthorizer; //导入依赖的package包/类
@Override
public void run(MqttHttpConfiguration configuration, Environment environment) throws Exception {
    // validator
    logger.debug("Initializing validator ...");
    Validator validator = new Validator(configuration);

    // storage
    SyncStorage storage = (SyncStorage) Class.forName(storageConfig.getString("storage.sync.class")).newInstance();
    environment.lifecycle().manage(new Managed() {
        @Override
        public void start() throws Exception {
            logger.debug("Initializing storage storage ...");
            storage.init(storageConfig);
        }

        @Override
        public void stop() throws Exception {
            logger.debug("Destroying storage storage ...");
            storage.destroy();
        }
    });

    // authenticator
    Authenticator authenticator = (Authenticator) Class.forName(authenticatorConfig.getString("authenticator.class")).newInstance();
    environment.lifecycle().manage(new Managed() {
        @Override
        public void start() throws Exception {
            logger.debug("Initializing authenticator ...");
            authenticator.init(authenticatorConfig);
        }

        @Override
        public void stop() throws Exception {
            logger.debug("Destroying authenticator ...");
            authenticator.destroy();
        }
    });

    // cluster
    Cluster cluster = (Cluster) Class.forName(clusterConfig.getString("cluster.class")).newInstance();
    environment.lifecycle().manage(new Managed() {
        @Override
        public void start() throws Exception {
            logger.debug("Initializing cluster ...");
            cluster.init(clusterConfig, null);
        }

        @Override
        public void stop() throws Exception {
            logger.debug("Destroying cluster ...");
            cluster.destroy();
        }
    });

    // OAuth
    environment.jersey().register(new AuthDynamicFeature(
            new OAuthCredentialAuthFilter.Builder<UserPrincipal>()
                    .setAuthenticator(new OAuthAuthenticator(authenticator))
                    .setAuthorizer(new PermitAllAuthorizer<>())
                    .setPrefix("Bearer")
                    .buildAuthFilter()));
    environment.jersey().register(RolesAllowedDynamicFeature.class);
    environment.jersey().register(new AuthValueFactoryProvider.Binder<>(UserPrincipal.class));

    // register resources
    environment.jersey().register(new MqttPublishResource(configuration.getServerId(), validator, storage, cluster, authenticator));
    environment.jersey().register(new MqttSubscribeResource(configuration.getServerId(), validator, storage, cluster, authenticator));
    environment.jersey().register(new MqttUnsubscribeResource(configuration.getServerId(), validator, storage, cluster, authenticator));

    // config jackson
    environment.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    environment.getObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    environment.getObjectMapper().configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
    environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
 
开发者ID:longkerdandy,项目名称:mithqtt,代码行数:76,代码来源:MqttHttp.java

示例3: registerAuthenticator

import io.dropwizard.auth.PermitAllAuthorizer; //导入依赖的package包/类
/**
 * This method registers the authenticator configured in this Configuration class with Jersey with a PermitAllAuthorizer
 * @param environment A DropWizard environment
 */
public void registerAuthenticator(Environment environment) {
    registerAuthenticator(environment, new PermitAllAuthorizer());
}
 
开发者ID:washingtonpost,项目名称:dropwizard-peer-authenticator,代码行数:8,代码来源:AllowedPeerConfiguration.java


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