All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.ks.fiks.maskinporten.MaskinportenAutoConfigure.kt Maven / Gradle / Ivy

There is a newer version: 3.3.2
Show newest version
package no.ks.fiks.maskinporten

import no.ks.fiks.virksomhetsertifikat.VirksomhetSertifikatAutoConfigure
import no.ks.fiks.virksomhetsertifikat.VirksomhetSertifikater
import org.springframework.boot.autoconfigure.AutoConfigureAfter
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
@EnableConfigurationProperties(MaskinportenProperties::class)
@AutoConfigureAfter(VirksomhetSertifikatAutoConfigure::class)
class MaskinportenAutoConfigure {

    @ConditionalOnBean(VirksomhetSertifikater::class)
    @ConditionalOnMissingBean
    @Bean
    fun getMaskinportenklient(properties: MaskinportenProperties, virksomhetSertifikater: VirksomhetSertifikater): Maskinportenklient {
        val authKeyStore = virksomhetSertifikater.requireAuthKeyStore()
        return Maskinportenklient(
            authKeyStore.keyStore, authKeyStore.privateKeyAlias, authKeyStore.privateKeyPassword, properties.toMaskinportenklientProperties())
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy