Skip to content

Commit 433d6e5

Browse files
committed
feat: support for learning-only users
1 parent b4f7d69 commit 433d6e5

File tree

3 files changed

+38
-19
lines changed

3 files changed

+38
-19
lines changed

README.md

+32-18
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ This utility can generate and validate key pairs, generate SAML assertions accep
44

55
Features:
66

7-
- [Generate a new key pair](#generate-a-new-key-pair)
8-
- [Check certificate validity](#check-the-oauth-client-certificates-validity)
9-
- [Generate assertion (and validate)](#generate-via-cli)
10-
- [Run a local web service to generate an assertion and provide access tokens](#run-a-web-service-returning-oauth-access-tokens)
11-
- [Integrate with a Postman OAuth flow to obtain an access token](#usage-with-postman)
7+
- [OAuth 2.0 SAML Assertion Access Token Generator for SAP SuccessFactors HXM Suite](#oauth-20-saml-assertion-access-token-generator-for-sap-successfactors-hxm-suite)
8+
- [Prerequisites](#prerequisites)
9+
- [Installation](#installation)
10+
- [Usage](#usage)
11+
- [Generate a new key pair](#generate-a-new-key-pair)
12+
- [Create or update the OAuth client in SuccessFactors](#create-or-update-the-oauth-client-in-successfactors)
13+
- [Run a web service returning OAuth access tokens](#run-a-web-service-returning-oauth-access-tokens)
14+
- [Usage with Postman](#usage-with-postman)
15+
- [Generate via CLI](#generate-via-cli)
16+
- [Argument Aliases](#argument-aliases)
17+
- [Check the OAuth client certificate's validity](#check-the-oauth-client-certificates-validity)
18+
- [Learning Only Users](#learning-only-users)
19+
- [Contributing](#contributing)
20+
- [Sponsorship](#sponsorship)
1221

1322
## Prerequisites
1423

@@ -127,19 +136,20 @@ Token is valid 🎉
127136
128137
#### Argument Aliases
129138
130-
| alias | argument |
131-
| ----- | ------------ |
132-
| -g | --generate |
133-
| -n | --newkeypair |
134-
| -c | --clientId |
135-
| -u | --userId |
136-
| -i | --companyId |
137-
| -h | --hostname |
138-
| -v | --validate |
139-
| -t | --ttl |
140-
| -p | --port |
141-
| -r | --raw |
142-
| -d | --dir |
139+
| alias | argument |
140+
| ----- | -------------- |
141+
| -g | --generate |
142+
| -n | --newkeypair |
143+
| -c | --clientId |
144+
| -u | --userId |
145+
| -i | --companyId |
146+
| -h | --hostname |
147+
| -v | --validate |
148+
| -t | --ttl |
149+
| -p | --port |
150+
| -r | --raw |
151+
| -d | --dir |
152+
| -l | --learningOnly |
143153
144154
### Check the OAuth client certificate's validity
145155
@@ -148,6 +158,10 @@ $ sf-oauth --validate [--companyId]
148158
notAfter=Mar 6 13:37:03 2032 GMT
149159
```
150160
161+
### Learning Only Users
162+
163+
The SuccessFactors Learning OAuth token server is deprecated. Instead, you can use the SuccessFactors Platform token server to generate OAuth tokens even if the user does not exist in Employee Profile or Employee Central, a so-called learning-only user. For this use-case, use the `-l` or `--learningOnly` argument.
164+
151165
## Contributing
152166
153167
Contributions are more than welcome! Please open an issue or a pull request.

src/cli.js

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ try {
2727
'--port': Number,
2828
'--raw': Boolean,
2929
'--dir': String,
30+
'--learningOnly': Boolean,
3031
// Aliases
3132
'-g': '--generate',
3233
'-n': '--newkeypair',
@@ -39,6 +40,7 @@ try {
3940
'-p': '--port',
4041
'-r': '--raw',
4142
'-d': '--dir',
43+
'-l': '--learningOnly'
4244
})
4345
} catch (err) {
4446
switch (err.code) {
@@ -100,6 +102,7 @@ if (args['--generate']) {
100102
userId,
101103
hostname,
102104
companyId,
105+
!!args['--learningOnly'],
103106
args['--ttl'],
104107
args['--raw']
105108
)

src/gen.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function generate(
88
sUser,
99
sHostname,
1010
companyId,
11+
learningOnly,
1112
iTtl = 600,
1213
silent = false
1314
) {
@@ -53,8 +54,9 @@ function generate(
5354
attributes: {
5455
api_key: sClientId,
5556
use_username: 'false',
57+
external_user: learningOnly ? 'true' : 'false'
5658
},
57-
nameIdentifier: sUser,
59+
nameIdentifier: learningOnly ? `${sUser}#DIV#${companyId}` : sUser,
5860
sessionIndex: crypto.randomUUID(),
5961
recipient: `https://${sHostname}/oauth/token`,
6062
}

0 commit comments

Comments
 (0)