I'm trying to create Internal Accounts programmaticaly by using proc metadata
.
The code section below creates person with External Login.
put"<Person Name=%str(%')&&PersonName&i.%str(%')>";
put"<Logins>";
put"<Login Name=%str(%')Login.&&PersonName&i.%str(%') Password=%str(%')&&word&i.%str(%')/>";
put"</Logins>";
put"</Person>";
To create ExternalLogin we can set attribute Password
, and in SAS Metadata it will be encrypted automaticaly.
But to create InternalLogin type of object it is necessary to make the hash value of the password and the salt. I know that the standard sas002
encryption method, but in the case of using proc pwencode
how to obtain the value of salt?
Is it possible create InternalLogin by using SAS Base?
Thanx.
So on. I found an article that can tell us how to create Stored Process for this problem. My answer is addition to the article.
The approach is base on execute java methods from sas programm.
1. Prerare setPasswd.java class
I've modified class from article. Separate code to connect to metadata server and create
InternalLogin
2. Resolve depends
Pay attention to imports in class. To enable execute the code below necessary set
CLASSPATH
enironment variable.On linux you can add the next command in
%SASConfig%/Lev1/level_env_usermods.sh
:On Windows you can add/change environment variable by
Advanced system settings
So where should you search jar files? They are in folder:
Which files i should include in path?
I've include all that used in OMI(Open Metadata Interface).Also I've added
log4j.jar
(not working without this jar. Your promts will be helpful):sas.oma.joma.jar
sas.oma.joma.rmt.jar
sas.oma.omi.jar
sas.svc.connection.jar
sas.core.jar
sas.entities.jar
sas.security.sspi.jar
log4j.jar
setPasswd.jar
(YOUR JAR FROM THE NEXT STEP!)Choose files from nearest release. Example:
Here I'm set file from
v940m3f
(fix release).Other ways is here.
3. Compile setPasswd.jar
I'm tried use internal
javac.exe
into SAS, but it's not worked properly. So ou need to download JDK to compile jars. I've create Bat-file:Paramethers
-source
and-target
will helpful if your version of JDK is upper, that usses in SAS. Version of "sas"-java you can see by:Search the next string in log:
4. Finally. SAS Base call
Now we can call Java code by this method (All methods available here):
In log:
Now time to test. Create new user with no passwords.
Execute code:
Now our user has InternalLogin object.
Thanx.