use of org.oxauth.persistence.model.Scope in project oxTrust by GluuFederation.
the class UmaScopeWebResourceTest method getUmaScope.
private Scope getUmaScope(String name) {
Scope scope = new Scope();
scope.setDescription(name + " description");
scope.setDisplayName(name);
scope.setIconUrl("https://api.gluu.org/icon/jl25");
scope.setId(UUID.randomUUID().toString());
scope.setUmaAuthorizationPolicies(new ArrayList<>());
return scope;
}
use of org.oxauth.persistence.model.Scope in project oxTrust by GluuFederation.
the class UpdateClientAction method updateScopes.
private void updateScopes() {
List<Scope> currentResponseTypes = this.scopes;
if (currentResponseTypes == null || currentResponseTypes.size() == 0) {
this.client.setOxAuthScopes(null);
return;
}
List<String> scopes = new ArrayList<String>();
for (Scope scope : this.scopes) {
scopes.add(scope.getDn());
}
this.client.setOxAuthScopes(scopes);
}
use of org.oxauth.persistence.model.Scope in project oxTrust by GluuFederation.
the class UpdateClientAction method getMarkDown.
public String getMarkDown() {
try {
StringBuilder sb = new StringBuilder();
sb.append(new Heading("OPENID CONNECT CLIENTS DETAILS", 2)).append("\n");
List<Object> items = new ArrayList<Object>();
if (client.getDisplayName() != null && !client.getDisplayName().isEmpty()) {
items.add("**Name:** " + client.getDisplayName());
}
if (client.getDescription() != null && !client.getDescription().isEmpty()) {
items.add("**Description:** " + client.getDescription());
}
if (client.getInum() != null && !client.getInum().isEmpty()) {
items.add("**Client ID:** " + client.getInum());
}
if (client.getSubjectType() != null && !client.getSubjectType().name().isEmpty()) {
items.add("**Subject Type:** " + client.getSubjectType());
}
if (client.getExp() != null && !client.getExp().toString().isEmpty()) {
items.add("**Expirattion date:** " + client.getExp());
}
if (client.getOxAuthClientSecret() != null && !client.getOxAuthClientSecret().toString().isEmpty()) {
items.add("**ClientSecret:** XXXXXXXXXXX");
}
if (client.getClientUri() != null && !client.getClientUri().toString().isEmpty()) {
items.add("**Client Uri:** " + client.getClientUri());
}
if (client.getIdTokenTokenBindingCnf() != null && !client.getIdTokenTokenBindingCnf().toString().isEmpty()) {
items.add("**TokenTokenBindingCnf:** " + client.getIdTokenTokenBindingCnf());
}
if (client.getOxAuthAppType() != null) {
items.add("**Application Type:** " + client.getOxAuthAppType().getValue());
}
items.add("**Persist Client Authorizations:** " + client.getOxAuthPersistClientAuthorizations());
items.add("**Pre-Authorization:** " + client.getOxAuthTrustedClient());
items.add("**Authentication method for the Token Endpoint:** " + client.getTokenEndpointAuthMethod());
items.add("**Logout Session Required:** " + client.getLogoutSessionRequired());
items.add("**Include Claims In Id Token:** " + client.getOxIncludeClaimsInIdToken());
items.add("**Disabled:** " + client.isDisabled());
if (client.getLogoutUri() != null && !client.getLogoutUri().isEmpty()) {
items.add("**Logout Uri:** " + client.getLogoutUri().toString());
}
if (client.getOxAuthPostLogoutRedirectURIs() != null && !client.getOxAuthPostLogoutRedirectURIs().isEmpty()) {
items.add("**Logout Redirect URIs:** " + client.getOxAuthPostLogoutRedirectURIs().toString());
}
if (client.getOxAuthRedirectURIs() != null && !client.getOxAuthRedirectURIs().isEmpty()) {
items.add("**Login Redirect URIs:** " + client.getOxAuthRedirectURIs().toString());
}
if (client.getOxAuthClaims() != null && !client.getOxAuthClaims().isEmpty()) {
items.add("**Claims:** " + client.getOxAuthClaims().toString());
}
if (client.getAccessTokenSigningAlg() != null && !client.getAccessTokenSigningAlg().name().isEmpty()) {
items.add("**AccessTokenSigningAlg:** " + client.getAccessTokenSigningAlg().name().toString());
}
if (client.getOxAuthScopes() != null && !client.getOxAuthScopes().isEmpty()) {
List<String> scopes = new ArrayList<String>();
for (Scope scope : this.scopes) {
scopes.add(scope.getId());
}
items.add("**Scopes:** " + scopes.toString());
}
if (client.getGrantTypes() != null && client.getGrantTypes().length > 0) {
items.add("**Grant types:** " + this.grantTypes.toString());
}
if (client.getResponseTypes() != null && client.getResponseTypes().length > 0) {
items.add("**Response types:** " + this.responseTypes.toString());
}
if (client.getContacts() != null && !client.getContacts().toString().isEmpty()) {
items.add("**Contacts:** " + this.contacts.toString());
}
if (client.getDefaultAcrValues() != null && client.getDefaultAcrValues().length > 0) {
items.add("**DefaultAcrValues:** " + Arrays.asList(client.getDefaultAcrValues()).toString());
}
sb.append(new UnorderedList<Object>(items)).append("\n");
markDown = sb.toString();
} catch (Exception e) {
log.error("Error computing markdown", e);
}
return markDown;
}
use of org.oxauth.persistence.model.Scope in project oxTrust by GluuFederation.
the class UpdateGluuRadiusConfigAction method searchAvailableScopes.
public void searchAvailableScopes() {
if (this.availableScopes != null) {
selectAddedScopes();
return;
}
List<SelectableEntity<Scope>> tmpAvailableScopes = new ArrayList<SelectableEntity<Scope>>();
List<Scope> scopes = new ArrayList<Scope>();
try {
scopes = scopeService.getAllScopesList(100);
} catch (Exception e) {
log.warn(e.getMessage(), e);
}
for (Scope scope : scopes) tmpAvailableScopes.add(new SelectableEntity<Scope>(scope));
this.availableScopes = tmpAvailableScopes;
selectAddedScopes();
}
use of org.oxauth.persistence.model.Scope in project oxTrust by GluuFederation.
the class UpdateGluuRadiusConfigAction method save.
public String save() {
List<String> scopednlist = new ArrayList<String>();
for (Scope scope : this.scopes) {
scopednlist.add(scope.getDn());
}
serverConfiguration.setScopes(scopednlist);
try {
gluuRadiusConfigService.updateServerConfiguration(serverConfiguration);
facesMessages.add(FacesMessage.SEVERITY_INFO, "#{msgs['radius.config.save.success']}");
conversationService.endConversation();
return OxTrustConstants.RESULT_SUCCESS;
} catch (Exception e) {
log.error("Failed to save radius server configuration", e);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "#{msgs['radius.config.save.error']}");
return OxTrustConstants.RESULT_FAILURE;
}
}
Aggregations