All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web.oauth.add.jsp Maven / Gradle / Ivy



<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%@ page import="org.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.identity.oauth.common.OAuthConstants" %>
<%@ page import="org.wso2.carbon.identity.oauth.stub.dto.TokenBindingMetaDataDTO" %>
<%@ page import="org.wso2.carbon.identity.oauth.ui.client.OAuthAdminClient" %>
<%@ page import="org.wso2.carbon.identity.oauth.ui.util.OAuthUIUtil" %>
<%@ page import="org.wso2.carbon.identity.core.util.IdentityUtil"%>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ResourceBundle" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>






<%
    String forwardTo = "index.jsp";
    String BUNDLE = "org.wso2.carbon.identity.oauth.ui.i18n.Resources";
    String DEFAULT_TOKEN_TYPE = "default";
    ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE, request.getLocale());
    String applicationSPName = request.getParameter("spName");
    
    OAuthAdminClient client = null;
    String audienceTableStyle = "display:none";
    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
    ConfigurationContext configContext = (ConfigurationContext) config.getServletContext()
            .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
    client = new OAuthAdminClient(cookie, backendServerURL, configContext);
    List allowedGrants = new ArrayList();
    List scopeValidators = new ArrayList();
    List tokenTypes = new ArrayList();
    
    String defaultIdTokenEncryptionAlgorithm =
            client.getSupportedIDTokenAlgorithms().getDefaultIdTokenEncryptionAlgorithm();
    String[] supportedIdTokenEncryptionAlgorithms =
            client.getSupportedIDTokenAlgorithms().getSupportedIdTokenEncryptionAlgorithms();
    String defaultIdTokenEncryptionMethod = client.getSupportedIDTokenAlgorithms().getDefaultIdTokenEncryptionMethod();
    String[] supportedIdTokenEncryptionMethods =
            client.getSupportedIDTokenAlgorithms().getSupportedIdTokenEncryptionMethods();
    TokenBindingMetaDataDTO[] supportedTokenBindingsMetaData = client.getSupportedTokenBindingsMetaData();
    
    try {
        allowedGrants = new ArrayList(Arrays.asList(client.getAllowedOAuthGrantTypes()));
    } catch (Exception e) {
        String message = resourceBundle.getString("error.while.getting.allowed.grants") + " : " + e.getMessage();
        CarbonUIMessage.sendCarbonUIMessage(message, CarbonUIMessage.ERROR, request, e);
%>



<%
    }
    try {
        scopeValidators = new ArrayList(Arrays.asList(client.getAllowedScopeValidators()));
        // Sorting the list to display the scope validators in alphabetical order
        Collections.sort(scopeValidators);
        tokenTypes = new ArrayList(Arrays.asList(client.getSupportedTokenTypes()));
    } catch (Exception e) {
        String message = resourceBundle.getString("error.while.getting.scope.validators") + " : " + e.getMessage();
        CarbonUIMessage.sendCarbonUIMessage(message, CarbonUIMessage.ERROR, request, e);
%>

<%
    }
%>





    
    
    
    
    
    
    

<%if (applicationSPName != null) {%> <% } else { %> <% } %> <%--Scope validators--%>
* <% String OAuth1FieldDisabled = "disabled"; boolean isOAuth1Enabled = IdentityUtil.isLegacyFeatureEnabled("oauth", "1.0"); if (isOAuth1Enabled) { OAuth1FieldDisabled = ""; } %> />1.0a 2.0
*
<% try { if (allowedGrants.contains("authorization_code")) { allowedGrants.remove("authorization_code"); %> <% } if (allowedGrants.contains("implicit")) { allowedGrants.remove("implicit"); %> <% } if (allowedGrants.contains("password")) { allowedGrants.remove("password"); %> <% } if (allowedGrants.contains("client_credentials")) { allowedGrants.remove("client_credentials"); %> <% } if (allowedGrants.contains("refresh_token")) { allowedGrants.remove("refresh_token"); %> <% } for (String grantType : allowedGrants) { if (grantType .equals("urn:ietf:params:oauth:grant-type:saml1-bearer")) { %> <% } else if (grantType .equals("urn:ietf:params:oauth:grant-type:saml2-bearer")) { %> <% } else if (grantType.equals("iwa:ntlm")) { %> <% } else { %> <% } } } catch (Exception e) { String message = resourceBundle.getString("error.while.getting.allowed.grants") + " : " + e.getMessage(); CarbonUIMessage .sendCarbonUIMessage(message, CarbonUIMessage.ERROR, request, e); %> <% } %>
Password
*
<% for (TokenBindingMetaDataDTO tokenBindingMetaDataDTO : supportedTokenBindingsMetaData) { %> "> <% } %>
" onclick="return addAudienceFunc()"/>
<% int j = 0; %>
<% try { for (String scopeValidator : scopeValidators) { %> <% } } catch (Exception e) { String message = resourceBundle .getString("error.while.getting.scope.validators") + " : " + e.getMessage(); CarbonUIMessage .sendCarbonUIMessage(message, CarbonUIMessage.ERROR, request, e); %> <% } %>
<% for (String tokenType : tokenTypes) { %> <% } %>
<% boolean applicationComponentFound = CarbonUIUtil.isContextRegistered(config, "/application/"); if (applicationComponentFound) { %> <% } else { %> <% } %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy