Spring Boot MSSQL Kerberos Authentication

Lokesh Agrawal :

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.

MuratOzkan :

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.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=441108&siteId=1