Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EventTracking
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨林
EventTracking
Commits
6c034d2a
Commit
6c034d2a
authored
Jul 23, 2021
by
杨林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kerberos认证类
parent
523cdfcb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
src/main/scala/tools/auth/KerberosAuth.scala
src/main/scala/tools/auth/KerberosAuth.scala
+30
-0
No files found.
src/main/scala/tools/auth/KerberosAuth.scala
0 → 100644
View file @
6c034d2a
package
tools.auth
import
org.apache.hadoop.conf.Configuration
import
org.apache.hadoop.security.UserGroupInformation
import
tools.properties.PropertiesTools
/**
* Created with IntelliJ IDEA.
* Class: KerberosAuth
* Description: kerberos认证
* User: lin
* Date: 2021-07-19
* Time: 16:17
*/
object
KerberosAuth
{
private
[
this
]
val
properties
=
PropertiesTools
.
getProperties
def
auth
()
:
Unit
=
{
System
.
setProperty
(
"java.security.krb5.conf"
,
properties
.
getProperty
(
"kerberos.config.path"
))
System
.
setProperty
(
"javax.security.auth.useSubjectCredsOnly"
,
properties
.
getProperty
(
"kerberos.javax.auth.useSubjectCredsOnly"
))
System
.
setProperty
(
"sun.security.krb5.debug"
,
"false"
)
val
conf
:
Configuration
=
new
Configuration
()
conf
.
set
(
"hadoop.security.authentication"
,
properties
.
getProperty
(
"hadoop.security.auth"
))
UserGroupInformation
.
setConfiguration
(
conf
)
UserGroupInformation
.
loginUserFromKeytab
(
properties
.
getProperty
(
"kerberos.hive.user"
),
properties
.
getProperty
(
"kerberos.hive.path"
))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment