Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the OIDC Authenticator to support Native SDK based Federation Flow in API Based Authentication #154

Merged
merged 12 commits into from
Oct 19, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.application.authenticator.oidc;

import org.apache.oltu.oauth2.client.response.OAuthClientResponse;
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;

/**
* This class holds the Native SDK based Federated OAuth Client response.
*/
public class NativeSDKBasedFederatedOAuthClientResponse extends OAuthClientResponse {

public void setAccessToken(String accessToken) {

this.parameters.put(OIDCAuthenticatorConstants.ACCESS_TOKEN, accessToken);
}

public void setIdToken(String idToken) {

this.parameters.put(OIDCAuthenticatorConstants.ID_TOKEN, idToken);
}


@Override
protected void setBody(String s) throws OAuthProblemException {

}

@Override
protected void setContentType(String s) {

}

@Override
protected void setResponseCode(int i) {

}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
* Copyright (c) 2015, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
/*
* Copyright (c) 2015, WSO2 LLC. (http://www.wso2.com).
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed year range should come in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed with #184

* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
Expand All @@ -20,8 +20,17 @@

import java.util.regex.Pattern;

/**
* This class holds the constants related to the OIDC authenticator.
*/
public class OIDCAuthenticatorConstants {

public static final String STATE_PARAM = "state.param";
public static final String ACCESS_TOKEN_PARAM = "accessToken";
public static final String CODE_PARAM = "code.param";
public static final String ID_TOKEN_PARAM = "idToken";
public static final String SESSION_DATA_KEY_PARAM = "sessionDataKey";

private OIDCAuthenticatorConstants() {

}
Expand Down Expand Up @@ -66,6 +75,9 @@ private OIDCAuthenticatorConstants() {
public static final String PROMPT_TYPE = "prompt_type";
public static final String REDIRECTION_PROMPT = "REDIRECTION_PROMPT";

/**
* This class holds the constants related to authenticator configuration parameters.
*/
public class AuthenticatorConfParams {

private AuthenticatorConfParams() {
Expand All @@ -75,6 +87,9 @@ private AuthenticatorConfParams() {
public static final String DEFAULT_IDP_CONFIG = "DefaultIdPConfig";
}

/**
* This class holds the constants related to IdP configuration parameters.
*/
public class IdPConfParams {

private IdPConfParams() {
Expand All @@ -89,6 +104,9 @@ private IdPConfParams() {
public static final String USER_INFO_EP = "UserInfoEndPoint";
}

/**
* This class holds the constants related to claims.
*/
public class Claim {

private Claim() {
Expand Down Expand Up @@ -123,6 +141,9 @@ private Claim() {
public static final String BACKCHANNEL_LOGOUT_EVENT_CLAIM = "{}";
}

/**
* This class holds the constants related to Back Channel Logout.
*/
public class BackchannelLogout {

private BackchannelLogout() {
Expand Down
Loading
Loading