Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OATS-CADC
ac
Commits
bd8809d5
Commit
bd8809d5
authored
8 years ago
by
Jeff Burke
Browse files
Options
Downloads
Patches
Plain Diff
s1890: change uuid2string to uuid2long
parent
db6cf4e0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java
+12
-12
12 additions, 12 deletions
...ol-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java
with
12 additions
and
12 deletions
cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java
+
12
−
12
View file @
bd8809d5
...
...
@@ -225,7 +225,7 @@ public class LdapUserDAO extends LdapDAO
{
HttpPrincipal
httpPrincipal
=
new
HttpPrincipal
(
username
);
User
user
=
getUser
(
httpPrincipal
);
Stri
ng
uuid
=
uuid2
stri
ng
(
user
.
getID
().
getUUID
());
lo
ng
uuid
=
uuid2
lo
ng
(
user
.
getID
().
getUUID
());
BindRequest
bindRequest
=
new
SimpleBindRequest
(
getUserDN
(
uuid
,
config
.
getUsersDN
()),
new
String
(
password
));
...
...
@@ -298,14 +298,14 @@ public class LdapUserDAO extends LdapDAO
try
{
Stri
ng
numericID
=
String
.
valueOf
(
genNextNumericId
()
)
;
lo
ng
numericID
=
genNextNumericId
();
String
password
=
UUID
.
randomUUID
().
toString
();
List
<
Attribute
>
attributes
=
new
ArrayList
<
Attribute
>();
addAttribute
(
attributes
,
LDAP_OBJECT_CLASS
,
LDAP_INET_ORG_PERSON
);
addAttribute
(
attributes
,
LDAP_OBJECT_CLASS
,
LDAP_INET_USER
);
addAttribute
(
attributes
,
LDAP_OBJECT_CLASS
,
LDAP_CADC_ACCOUNT
);
addAttribute
(
attributes
,
LDAP_UID
,
numericID
);
addAttribute
(
attributes
,
LDAP_UID
,
String
.
valueOf
(
numericID
)
)
;
addAttribute
(
attributes
,
LDAP_USER_NAME
,
EXTERNAL_USER_CN
);
addAttribute
(
attributes
,
LDAP_LAST_NAME
,
EXTERNAL_USER_SN
);
addAttribute
(
attributes
,
LADP_USER_PASSWORD
,
password
);
...
...
@@ -409,13 +409,13 @@ public class LdapUserDAO extends LdapDAO
try
{
Stri
ng
numericID
=
String
.
valueOf
(
genNextNumericId
()
)
;
lo
ng
numericID
=
genNextNumericId
();
List
<
Attribute
>
attributes
=
new
ArrayList
<
Attribute
>();
addAttribute
(
attributes
,
LDAP_OBJECT_CLASS
,
LDAP_INET_ORG_PERSON
);
addAttribute
(
attributes
,
LDAP_OBJECT_CLASS
,
LDAP_INET_USER
);
addAttribute
(
attributes
,
LDAP_OBJECT_CLASS
,
LDAP_CADC_ACCOUNT
);
addAttribute
(
attributes
,
LDAP_UID
,
numericID
);
addAttribute
(
attributes
,
LDAP_UID
,
String
.
valueOf
(
numericID
)
)
;
addAttribute
(
attributes
,
LDAP_USER_NAME
,
userID
.
getName
());
addAttribute
(
attributes
,
LDAP_LAST_NAME
,
user
.
personalDetails
.
getLastName
());
addAttribute
(
attributes
,
LADP_USER_PASSWORD
,
new
String
(
userRequest
.
getPassword
()));
...
...
@@ -508,7 +508,7 @@ public class LdapUserDAO extends LdapDAO
String
name
;
if
(
userID
instanceof
NumericPrincipal
)
{
name
=
uuid2
stri
ng
(
UUID
.
fromString
(
userID
.
getName
()));
name
=
String
.
valueOf
(
uuid2
lo
ng
(
UUID
.
fromString
(
userID
.
getName
()))
)
;
}
else
{
...
...
@@ -859,7 +859,7 @@ public class LdapUserDAO extends LdapDAO
{
throw
new
RuntimeException
(
"BUG: missing HttpPrincipal for "
+
userID
.
getName
());
}
String
uid
=
"uid="
+
uuid2
stri
ng
(
userRequest
.
getID
().
getUUID
());
String
uid
=
"uid="
+
uuid2
lo
ng
(
userRequest
.
getID
().
getUUID
());
String
dn
=
uid
+
","
+
config
.
getUserRequestsDN
();
try
...
...
@@ -1066,7 +1066,7 @@ public class LdapUserDAO extends LdapDAO
User
user2Delete
=
getUser
(
userID
,
usersDN
);
try
{
Stri
ng
uuid
=
uuid2
stri
ng
(
user2Delete
.
getID
().
getUUID
());
lo
ng
uuid
=
uuid2
lo
ng
(
user2Delete
.
getID
().
getUUID
());
DN
userDN
=
getUserDN
(
uuid
,
usersDN
);
if
(
markDelete
)
{
...
...
@@ -1137,7 +1137,7 @@ public class LdapUserDAO extends LdapDAO
// DN can be formulated if it is the numeric id
if
(
p
instanceof
NumericPrincipal
)
return
this
.
getUserDN
(
p
.
getName
(),
config
.
getUsersDN
());
return
this
.
getUserDN
(
uuid2long
(
UUID
.
fromString
(
p
.
getName
()
))
,
config
.
getUsersDN
());
// Otherwise we need to search for the numeric id
String
searchField
=
userLdapAttrib
.
get
(
p
.
getClass
());
...
...
@@ -1180,7 +1180,7 @@ public class LdapUserDAO extends LdapDAO
return
searchResult
.
getAttributeValueAsDN
(
LDAP_ENTRYDN
);
}
protected
DN
getUserDN
(
Stri
ng
numericID
,
String
usersDN
)
protected
DN
getUserDN
(
lo
ng
numericID
,
String
usersDN
)
throws
LDAPException
,
TransientException
{
return
new
DN
(
LDAP_UID
+
"="
+
numericID
+
","
+
usersDN
);
...
...
@@ -1241,9 +1241,9 @@ public class LdapUserDAO extends LdapDAO
return
rand
.
nextInt
(
Integer
.
MAX_VALUE
-
10000
)
+
10000
;
}
protected
Stri
ng
uuid2
stri
ng
(
UUID
uuid
)
protected
lo
ng
uuid2
lo
ng
(
UUID
uuid
)
{
return
String
.
valueOf
(
uuid
.
getLeastSignificantBits
()
)
;
return
uuid
.
getLeastSignificantBits
();
}
protected
InternalID
getInternalID
(
String
numericID
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment