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

New OIDC PIP #24

Open
wants to merge 6 commits into
base: iota-ca-support
Choose a base branch
from

Conversation

marcocaberletti
Copy link
Contributor

First implementation of OIDC PIP

Copy link
Contributor

@andreaceccanti andreaceccanti left a comment

Choose a reason for hiding this comment

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

LGTM, with minor changes requested

this.decoder = decoder;
}

protected boolean isOidcProfile(Request request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to isOidcProfileRequest


if (!isOidcProfile(request)) {
String msg = "Request doesn't match OIDC profile";
LOG.error(msg);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really an error condition? If the PEP supports multiple profiles it shouldn't be reported as an error.

TokenInfo tokenInfo = decoder.decodeAccessToken(accessToken.get());

if (!tokenInfo.getIntrospection().isActive()) {
String msg = String.format("Invalid access token: '%s'", request);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really an error condition? With the X.509 PIP we simply remove the X.509 attributes when a credential is no longer valid if I am not mistaken.

throw new PIPProcessingException(msg);
}

tokenService.cleanOidcAttributes(request);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be moved up, as the first instruction after having determined that the OIDC profile applies.

import org.glite.authz.common.model.Request;
import org.glite.authz.oidc.client.model.TokenInfo;

public interface OidcProfileToken {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be renamed OidcProfileTokenService

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OidcProfileTokenImpl implements OidcProfileToken {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to OidcProfileTokenServiceImpl

for (Attribute attr : sub.getAttributes()) {
if (ID_ATTRIBUTE_OIDC_ACCESS_TOKEN.equals(attr.getId())) {
Set<Object> values = attr.getValues();
accessToken = Optional.of(values.iterator().next().toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

If values is empty a NPE will be raised here. Add a check that controls that the attribute has at least 1 value or otherwise raises an exception (with a meaningful error message)

attributesToAdd.add(oidcSubject);

if (tokenInfo.getIntrospection() == null) {
LOG.warn("No introspection data into access token.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Error message should be

LOG.warn("No introspection data returned by token service for access token : %s", token);

token is the token string

}

if (tokenInfo.getUserinfo() == null) {
LOG.warn("No user info data into access token.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Error message should be

LOG.warn("No userinfo data returned by token service for access token : %s", token);

token is the token string

LOG.debug("Sending request to OIDC client '{}'", oidcHttpService.getOidcClientUrl());

String response = oidcHttpService.postRequest(accessToken);
LOG.debug("Get response from OIDC client: '{}'", response);
Copy link
Contributor

Choose a reason for hiding this comment

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

Get response -> Response from OIDC client:

@argus-authz argus-authz deleted a comment from andreaceccanti Jan 17, 2018
@argus-authz argus-authz deleted a comment from andreaceccanti Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants