Spring Boot MSSQL Kerberos Authentication

一笑奈何 提交于 2019-12-13 12:58:40

问题


Currently in my spring boot application.properties file, I am specifying following lines to connect to MSSql server.

spring.datasource.url=jdbc:sqlserver://localhost;databaseName=springbootd

spring.datasource.username=sa

spring.datasource.password=Projects@123

Instead of giving username and password, I want to authenticate user using kerberos, what all changes I will have to make.

I tried searching in the JPA official documentation but could not find any. Leads here are appreciated.


回答1:


Basically, you need to set up your krb5.conf file properly. You can verify that configuration via the following command and entering your password:

kinit <user-name>

Additionally, make sure you have a JDBC URL like:

jdbc:sqlserver://servername=server_name;integratedSecurity=true;authenticationScheme=JavaKerberos;userName=user@REALM;password=****

See Microsoft JDBC driver documentation for details.

EDIT:

Forgot to mention the startup arguments. Add the following JVM argument:

-Djava.security.krb5.conf=<PATH_TO>/krb5.conf

I believe this is not neccessary if you use the default krb5.conf but not entirely sure.



来源:https://stackoverflow.com/questions/50074354/spring-boot-mssql-kerberos-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!