-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove jans-auth-common dependency #1459
- Loading branch information
1 parent
d155a9d
commit 75f4fb5
Showing
4 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
jans-scim/service/src/main/java/io/jans/scim/service/ExternalIdGeneratorService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.scim.service; | ||
|
||
import io.jans.model.SimpleCustomProperty; | ||
import io.jans.model.custom.script.CustomScriptType; | ||
import io.jans.model.custom.script.conf.CustomScriptConfiguration; | ||
import io.jans.model.custom.script.type.id.IdGeneratorType; | ||
import io.jans.service.custom.script.ExternalScriptService; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Named; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author gasmyr on 9/17/20. | ||
*/ | ||
@ApplicationScoped | ||
@Named("externalIdGeneratorService") | ||
public class ExternalIdGeneratorService extends ExternalScriptService { | ||
|
||
private static final long serialVersionUID = 1727751544454591273L; | ||
|
||
public ExternalIdGeneratorService() { | ||
super(CustomScriptType.ID_GENERATOR); | ||
} | ||
|
||
public String executeExternalGenerateIdMethod(CustomScriptConfiguration customScriptConfiguration, String appId, String idType, String idPrefix) { | ||
try { | ||
log.debug("Executing python 'generateId' method"); | ||
IdGeneratorType externalType = (IdGeneratorType) customScriptConfiguration.getExternalType(); | ||
Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes(); | ||
return externalType.generateId(appId, idType, idPrefix, configurationAttributes); | ||
} catch (Exception ex) { | ||
log.error(ex.getMessage(), ex); | ||
saveScriptError(customScriptConfiguration.getCustomScript(), ex); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public String executeExternalDefaultGenerateIdMethod(String appId, String idType, String idPrefix) { | ||
return executeExternalGenerateIdMethod(this.defaultExternalCustomScript, appId, idType, idPrefix); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters